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}')))
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.