我有这个代理服务将两个xml消息聚合成一个。WSO2聚合器 - xpath无法遍历
- 我已经配置我的聚合器类使用XPath
- 我不知道我的命名空间的XPath是否有效。我无法跟踪日志。
我的代理服务器配置:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="prescription"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<aggregate>
<completeCondition>
<messageCount min="2" max="2"/>
</completeCondition>
<onComplete expression="//soapenv:Envelope//f:Prescription//f:identifier//f:id//@value">
<send>
<endpoint>
<address uri="jms:/report?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
</endpoint>
</send>
</onComplete>
</aggregate>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
我输入消息是这样的:(我要根据病人ID汇总)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://isova.wipro.com/">
<Prescription xmlns="http://hl7.org/fhir">
<identifier>
<id value="A0001"/>
</identifier>
<status value="active"/>
<patient>
<type value="Patient"/>
<url value="Bhavani"/>
</patient>
<prescriber>
<type value="Provider"/>
<url value="Dr.Mathews"/>
</prescriber>
<medicine>
<identification>
<text value="Zintac"/>
</identification>
</medicine>
</Prescription></soapenv:Envelope>
有什么建议?
问候 大师 @gnanagurus
我不能帮助解决这个问题。这是我最新的WSO2代理。
这些是'处方'队列中存在的两条消息。
消息1:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://isova.wipro.com/">
<Prescription xmlns="http://hl7.org/fhir">
<identifier>
<id value="A0001"/>
</identifier>
<status value="active"/>
<patient>
<type value="Patient"/>
<url value="Bhavani"/>
</patient>
<prescriber>
<type value="Provider"/>
<url value="Dr.Mathews"/>
</prescriber>
<medicine>
<identification>
<text value="Zintac"/>
</identification>
</medicine>
</Prescription></soapenv:Envelope></soapenv:Body></soapenv:Envelope>
消息2:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://isova.wipro.com/">
<Prescription xmlns="http://hl7.org/fhir">
<identifier>
<id value="A0001"/>
</identifier>
<status value="active"/>
<patient>
<type value="Patient"/>
<url value="Bhavani"/>
</patient>
<prescriber>
<type value="Provider"/>
<url value="Dr.John"/>
</prescriber>
<medicine>
<identification>
<text value="tintac"/>
</identification>
</medicine>
</Prescription></soapenv:Envelope></soapenv:Body></soapenv:Envelope>
代理:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="prescription"
transports="https http jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="/Prescription">
<send>
<endpoint>
<address uri="jms:/report?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
</endpoint>
</send>
</onComplete>
</aggregate>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
这不是解决我的聚集。这两条消息没有得到聚合器。我尝试使用名称空间的多个xpath。 Anyhelp非常需要。
是否有任何WSO2聚合器自定义Java类,我可以使用,而不是聚合中介?
问候 大师
作为一个提示,也许不要在xpath表达式中使用太多//因为您知道结构 - one /就足够了。 – FiveO 2013-05-01 14:40:54