我有一个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或unit。
发布于 2019-03-14 12:50:18
问题出在您提供的映射上,由于映射不正确,映射器正在丢弃传入的事件。在@map注解@attribute部分中,您应该提供正确的xpath映射来提取need.Please引用these测试用例的属性,在这些测试用例中,它使用xpath表达式执行自定义映射。
https://stackoverflow.com/questions/55147916
复制相似问题