0

我如何配置@sink 来调用基于soap 的web api?我在哪里可以指定肥皂动作?我在网上找到的参考不能正常工作?

    @sink(type='http',publisher.url='http://localhost:8009/foo', method='{POST}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120}')))
4

1 回答 1

3

下面是一个示例配置,您可以如何调用 SOAP 端点。在这里,我们使用带有XML 源映射器的HTTP 接收器。希望这能满足您的要求。

@App:name("SiddhiAppSOAPTest")
@App:description("Description of the plan")

-- Please refer to https://docs.wso2.com/display/SP400/Quick+Start+Guide on getting started with SP editor. 

define stream inputStream(attr1 int);

@sink(type='http', publisher.url='http://localhost:8280/services/echo', method='POST',headers="'Content-Type:text/xml','SOAPAction:urn:echoInt'",
@map(type='xml', enclosing.element="<soapenv:Envelope xmlns:echo='http://echo.services.core.carbon.wso2.org' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>",
    @payload( "<soapenv:Header/><soapenv:Body><echo:echoInt><in>{{attr1}}</in></echo:echoInt></soapenv:Body>")
)
)
define stream outputStream (attr1 int);

from inputStream
select *
insert into outputStream;

如您所见,我已将 SOAPAction 定义为 HTTP 标头和 Content-Type。

于 2018-11-03T07:13:31.820 回答