WSO2: Stream Processor

自闭症网瘾萝莉.ら 提交于 2019-12-11 19:31:48

问题


How can i configure @sink to call a soap based web api? where can i specify the soap action? reference i found online aren't working properly?

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


Below is an example configuration how you can invoke SOAP endpoint. Here we are utilizing HTTP sink with XML source mapper. Hope this fulfill your requirement.

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

As you can observe I have defined SOAPAction as a HTTP header and also the Content-Type.



来源:https://stackoverflow.com/questions/53061131/wso2-stream-processor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!