I have this proxy service to aggregate two xml messages into one.
- I have configured my aggregator class with xpath
- I am not sure whether my xpath with namespace works. I couldnt trace with logs.
My proxy configuration:
<?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>
My input messages looks like this: ( I want to aggregate based on the patient 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>
Any suggestions ?
Regards Guru @gnanagurus
I couldnt help to solve this issue. This is my latest WSO2 proxy.
These are the two messages exist in'Prescription' queue.
Message1:
<?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>
Message 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>
Proxy:
<?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>
This is not solving my aggregation. These two messages are not getting aggregator. I tried with multiple xpath with namespaces. Anyhelp is greatly needed.
Is there any WSO2 Aggregator custom java class which I can use instead of aggregate mediator ?
Regards Guru