WSO2:流处理器 [英] WSO2: Stream Processor

查看:28
本文介绍了WSO2:流处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

以下是如何调用 SOAP 端点的示例配置.这里我们使用 HTTP sinkXML 源映射器.希望这能满足您的要求.

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;

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

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

这篇关于WSO2:流处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆