WSO2:流处理器

时间:2018-10-30 09:30:33

标签: soap wso2 wso2sp

我如何配置@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}')))

1 个答案:

答案 0 :(得分:2)

下面是一个示例配置,介绍了如何调用SOAP端点。在这里,我们将HTTP sinkXML source mapper一起使用。希望这能满足您的要求。

@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。

相关问题