0

我有一个 WSO2 流处理器应用程序,它发出一个 http-resquest 并接收一个 http-response:

@sink(type='http-request', sink.id='sinkid',  publisher.url='http://xxx.xx.xxx.xxx', @map(type='xml', @payload('{{payloadBody}}')))
define stream SomeStream (payloadBody String, method string, headers string);

@source(type='http-response', sink.id='sinkid', http.status.code='200', 
@map(type='xml', @attributes(parval='parval')))
define stream responseSomeStream(parval string);

如何将任何数据提取到控制台?我尝试了几种方法,但都没有奏效。

发送有效负载后我在控制台上得到的是:

{org.wso2.extension.siddhi.map.xml.sourcemapper.XmlSourceMapper} - Xpath: 'parval did not yield any results. Hence dropping the event : <resp action="read" units="S" user="TheUser" password="xxxxxxx" error="0"><val nodetype="16" node="2" display="u09 S5 Temp." name="u09 S5 Temp." stat="Online" statcode="2" error="0" pending="false" parval="-26.0" units="degc" units_index="4"> -26.0°C</val></resp> (Encoded)

我想从这个 XML 响应中提取一些参数,例如 statcode、parval 或单位。

4

1 回答 1

0

问题在于您提供的映射,并且由于映射不正确,映射器正在删除传入事件。在@map 注释@attribute 部分中,您应该提供正确的xpath 映射以提取您需要的属性。请参考这些测试用例,其中它使用xpath 表达式执行自定义映射。

于 2019-03-14T04:50:17.677 回答