dblookup mediator not executed if it is placed after an iterate mediator - wso2-esb

Does anyone know why a dblookup mediator is not executed if it is placed after an iterate mediator and both of these mediators are enclosed within a filter mediator? See my code snippet and corresponding log below. Thank you in advance.
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="DownloadSeq" onError="AppDefaultFailSeq"
trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<dblookup description="DOWNLOAD FILES">
<connection>
<pool>
<dsName>jdbc/dsName</dsName>
</pool>
</connection>
<statement>
<sql><![CDATA[some sql query]]></sql>
<result column="id" name="fileId"/>
<result column="file_name_pattern" name="fileNamePattern"/>
<result column="uri" name="fileSource"/>
<result column="file_dest" name="fileDest"/>
</statement>
</dblookup>
<!-- CHECK TO SEE IF A RECORD IS RETURNED. EXIT IF NO RECORD RETURNED -->
<filter xpath="boolean(get-property('fileId'))">
<then>
<fileconnector.search>
<source>{$ctx:fileSource}</source>
<filePattern>{$ctx:fileNamePattern}</filePattern>
<recursiveSearch>False</recursiveSearch>
</fileconnector.search>
<log level="full"/>
<property name="sequence" scope="default" type="STRING" value="after-smooks"/>
<iterate expression="//ns:result/ns:file" xmlns:ns="http://org.wso2.esbconnectors.FileConnector">
<target>
<sequence>
<log level="full"/>
<property expression="//ns:file" name="fileName"
scope="default" type="STRING"/>
<!-- DOWNLOAD THE FILE -->
<fileconnector.move>
<source>{$ctx:fileSource}</source>
<destination>{$ctx:fileDest}</destination>
</fileconnector.move>
</sequence>
</target>
</iterate>
<!-- UPDATE STATUS AS 'P' -->
<dblookup description="Update status to P">
<connection>
<pool>
<dsName>jdbc/dsName</dsName>
</pool>
</connection>
<statement>
<sql><![CDATA[some SQL statement]]></sql>
<parameter expression="get-property('fileId')" type="INTEGER"/>
<parameter type="CHAR" value="P"/>
</statement>
</dblookup>
<drop/>
</then>
<else>
<drop/>
</else>
</filter>
</sequence>
From the log file:
TID: [-1234] [] [2016-10-03 10:48:00,848] DEBUG {org.apache.synapse.mediators.ext.ClassMediator} - Start : Class mediator {org.apache.synapse.mediators.ext.ClassMediator}
TID: [-1234] [] [2016-10-03 10:48:00,849] DEBUG {org.apache.synapse.mediators.ext.ClassMediator} - invoking : class org.wso2.carbon.connector.FileMove.mediate() {org.apache.synapse.mediators.ext.ClassMediator}
TID: [-1234] [] [2016-10-03 10:48:01,396] DEBUG {org.apache.synapse.mediators.ext.ClassMediator} - End : Class mediator {org.apache.synapse.mediators.ext.ClassMediator}
TID: [-1234] [] [2016-10-03 10:48:01,397] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - End : Sequence <anonymous> {org.apache.synapse.mediators.base.SequenceMediator}
However, if I placed the dblookup mediator within the iterator mediator, it works as expected. see corresponding logs below.
TID: [-1234] [] [2016-10-03 10:33:01,037] DEBUG {org.apache.synapse.mediators.ext.ClassMediator} - Start : Class mediator {org.apache.synapse.mediators.ext.ClassMediator}
TID: [-1234] [] [2016-10-03 10:33:01,038] DEBUG {org.apache.synapse.mediators.ext.ClassMediator} - invoking : class org.wso2.carbon.connector.FileMove.mediate() {org.apache.synapse.mediators.ext.ClassMediator}
TID: [-1234] [] [2016-10-03 10:33:01,525] DEBUG {org.apache.synapse.mediators.ext.ClassMediator} - End : Class mediator {org.apache.synapse.mediators.ext.ClassMediator}
TID: [-1234] [] [2016-10-03 10:33:01,526] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - Start : DBLookup mediator {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,526] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - Getting a connection from DataSource jdbc/dsName and preparing statement : SELECT update_file_status(?,?) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,526] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - Setting as parameter : 1 value : 16 as JDBC Type : 4(see java.sql.Types for valid types) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,526] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - Setting as parameter : 2 value : P as JDBC Type : 1(see java.sql.Types for valid types) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,526] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - Successfully prepared statement : SELECT update_file_status(?,?) against DataSource : jdbc/dsName {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,527] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - Processing the first row returned : SELECT update_file_status(?,?) {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,527] DEBUG {org.apache.synapse.mediators.db.DBLookupMediator} - End : DBLookup mediator {org.apache.synapse.mediators.db.DBLookupMediator}
TID: [-1234] [] [2016-10-03 10:33:01,528] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - End : Sequence <anonymous> {org.apache.synapse.mediators.base.SequenceMediator}

In iterate mediator, use attribute continueParent="true"

Related

Getting "Connection closed before sending request out" in WSO2 ESB for newly created API

I'm getting "Connection closed before sending request out" in my WSO2 ESB API when a request is made to an endpoint. I am not using a proxy server.
Here is the source for the API that I have created:
<api xmlns="http://ws.apache.org/ns/synapse" name="WorkspaceONEUser" context="/workspaceone/user" port="8243">
<resource methods="POST" uri-template="*">
<inSequence>
<log>
<property name="Message Flow" value="POST WorkspaceONEUser Search - IN"/>
</log>
<send>
<endpoint key="workspaceOneUserSearchEndpoint"/>
</send>
</inSequence>
<outSequence>
<property name="Access-Control-Allow-Headers" value="authorization,Access-Control-Allow-Origin,Content-Type,X-Requested-With,Accept,Allow,Access-Control-Allow-Credentials" scope="transport"/>
<property name="Access-Control-Allow-Origin" value="HOST_NAME" scope="transport" type="STRING"/>
<property name="Access-Control-Allow-Credentials" value="true" scope="transport" type="STRING"/>
<log>
<property name="Message Flow" value="POST WorkspaceONEUser - OUT"/>
</log>
<log level="full"/>
<send/>
</outSequence>
<faultSequence>
<log>
<property name="message" value="in fault"/>
<property name="text" value="An unexpected error occured"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
<property name="header" expression="get-property('REQUEST_HOST_HEADER')"/>
</log>
</faultSequence>
</resource>
<resource methods="OPTIONS" url-mapping="/">
<inSequence>
<log>
<property name="Message Flow" value="IN OPTIONS"/>
</log>
<log level="full"/>
<property name="Access-Control-Allow-Headers" value="authorization,Access-Control-Allow-Origin,Content-Type,X-Requested-With,Accept,Allow,Access-Control-Allow-Credentials" scope="transport"/>
<property name="Access-Control-Allow-Origin" value="https://HOST_NAME" scope="transport" type="STRING"/>
<property name="Access-Control-Allow-Credentials" value="true" scope="transport" type="STRING"/>
<respond/>
</inSequence>
</resource>
</api>
In the logs, it appears that the connection is being closed before it is sent out:
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} - Sending message through endpoint : workspaceOneUserSearchEndpoint resolving to address = https://TARGET_HOST {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} - SOAPAction: null {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} - WSA-Action: null {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} - Sending [add = false] [sec = false] [mtom = false] [swa = false] [format = null] [force soap11=false] [force soap12=false] [pox=false] [get=false] [encoding=null] [to=https://TARGET_HOST] {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} - Message [Original Request Message ID : urn:uuid:09116122-22b4-4acf-be8e-31570623bd39] [New Cloned Request Message ID : urn:uuid:b242c096-4348-4977-8048-d70a5ac8c15b] {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} - Setting Timeout for endpoint : Endpoint [workspaceOneUserSearchEndpoint], URI : https://TARGET_HOST to static timeout value : 120000 {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,284] DEBUG {org.apache.synapse.core.axis2.SynapseCallbackReceiver} - Callback added. Total callbacks waiting for : 2 {org.apache.synapse.core.axis2.SynapseCallbackReceiver}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.axis2.transport.http.ApplicationXMLFormatter} - start writeTo() {org.apache.axis2.transport.http.ApplicationXMLFormatter}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.axis2.transport.http.ApplicationXMLFormatter} - end writeTo() {org.apache.axis2.transport.http.ApplicationXMLFormatter}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.synapse.mediators.builtin.SendMediator} - End : Send mediator {org.apache.synapse.mediators.builtin.SendMediator}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} - End : Sequence <anonymous> {org.apache.synapse.mediators.base.SequenceMediator}
TID: [-1] [] [2019-01-28 13:38:34,781] WARN {org.apache.synapse.transport.passthru.TargetHandler} - Connection closed before sending request out Remote Address : wsoidm01pa.jefferson.edu/147.140.23.161:443 {org.apache.synapse.transport.passthru.TargetHandler}
Does anyone know what might be causing this? I suspect that this indicates a connection between the ESB and a downstream server has closed before the ESB was able to completely write the request out.
However, I'm able to POST to the same endpoint from another API that's almost identical. Is there something that's obviously wrong with my API or endpoint that's causing this mysterious problem?
Try to add this property before your <send> mediator.
<property name="ClientApiNonBlocking"
value="true"
scope="axis2"
action="remove"/>
It will remove your Client Api Non Blocking in your <send> mediator (which is enable by default)

Wso2 - call sequence with get-property

This is the scenario:
- Three sequences: s1, s2, s3
- One variable stored in a registry (localEntry) sets to 1
- Get the seqName with a concat
- Try to call the sequence with get-property
What I've done until now:
1) Extract the value
<property name="getSequence" expression="get-property('registry','conf:repository/myVersion2.xml')" scope="default" type="OM"/>
<log level="custom">
<property name="TestVersion::localEntry" expression="$ctx:getSequence//localEntry"/>
</log>
2) Concat
<property name="seqName"
expression="concat('s', $ctx:getSequence//localEntry)"
scope="default"
type="STRING"/>
3) Call the sequence
<sequence key="get-property('seqName')"/>
4) Execute the test
5) Get error:
TID: [0] [ESB] [2015-07-08 10:27:36,325] INFO {org.apache.synapse.mediators.builtin.LogMediator} - TestVersion::info = setting property {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327] INFO {org.apache.synapse.mediators.builtin.LogMediator} - TestVersion::localEntry = 1 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327] INFO {org.apache.synapse.mediators.builtin.LogMediator} - TestVersion::Sequence = s1 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327] INFO {org.apache.synapse.mediators.builtin.LogMediator} - TestVersion::info = filter1 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327] INFO {org.apache.synapse.mediators.builtin.LogMediator} - TestVersion::info = LOG_S1_TRUE {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,329] ERROR {org.apache.synapse.mediators.base.SequenceMediator} - Sequence named Value {name ='null', keyValue ='get-property('seqName')'} cannot be found {org.apache.synapse.mediators.base.SequenceMediator}
So the problem seems how the information stored in 'seqName' could be read by the sequence as the sequence name and not as a string.
I tried also with
<sequence key="{get-property('seqName')}"/>
But this doesn't work too...
Thank you in advance.
Claudio
Fixed!
<sequence xmlns:local="ws.apache.org/ns/synapse" key="{get-property('seqName')}"/>
Thanks to everybody!
Regards
Claudio

WSO2 ESB Trying to create proxy service to c0onnect to rest service to pull data

I am new to the wso2 esb server and I am trying to create a proxy service to connect to a rest service. I am having issue trying to test the proxy when in the "Deployed Services" page of the esb. The source view of the proxy service is:
> <?xml version="1.0" encoding="UTF-8"?>
> <proxy xmlns="http://ws.apache.org/ns/synapse"
> name="search"
> transports="https,http,local"
> statistics="disable"
> trace="disable"
> startOnLoad="true">
> <target>
> <outSequence>
> <send/>
> </outSequence>
> <faultSequence>
> <log level="full" category="DEBUG"/>
> </faultSequence>
> <endpoint>
> <http method="get" uri-template="http://52.24.50.197:8080/search"/>
> <property name="q" value="test"/>
> </endpoint> </target> <description/> </proxy>
I click on "Try this Service" link and I get this in the console:
[2015-05-19 09:06:43,573] DEBUG - SynapseMessageReceiver Synapse received a new message for message mediation...
[2015-05-19 09:06:43,574] DEBUG - SynapseMessageReceiver Received To: /services/mediate/mediate
[2015-05-19 09:06:43,575] DEBUG - SynapseMessageReceiver SOAPAction: null
[2015-05-19 09:06:43,575] DEBUG - SynapseMessageReceiver WSA-Action: null
[2015-05-19 09:06:43,575] DEBUG - Axis2SynapseEnvironment Injecting MessageContext
[2015-05-19 09:06:43,576] DEBUG - Axis2SynapseEnvironment Using Main Sequence for injected message
[2015-05-19 09:06:43,576] DEBUG - SequenceMediator Start : Sequence <main>
[2015-05-19 09:06:43,576] DEBUG - SequenceMediator Sequence <SequenceMediator> :: mediate()
[2015-05-19 09:06:43,577] DEBUG - SequenceMediator Mediation started from mediator position : 0
[2015-05-19 09:06:43,577] DEBUG - InMediator Start : In mediator
[2015-05-19 09:06:43,578] DEBUG - InMediator Current message is incoming - executing child mediators
[2015-05-19 09:06:43,578] DEBUG - InMediator Sequence <InMediator> :: mediate()
[2015-05-19 09:06:43,578] DEBUG - InMediator Mediation started from mediator position : 0
[2015-05-19 09:06:43,579] DEBUG - LogMediator Start : Log mediator
[2015-05-19 09:06:43,579] INFO - LogMediator To: /services/mediate/mediate, MessageID: urn:uuid:e2c5b5f7-3c2c-4969-9c0b-6aa4d8282f2d, Direction: requ
st, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body></soapen
:Body></soapenv:Envelope>
[2015-05-19 09:06:43,580] DEBUG - LogMediator End : Log mediator
[2015-05-19 09:06:43,581] DEBUG - FilterMediator Start : Filter mediator
[2015-05-19 09:06:43,581] DEBUG - FilterMediator Source : get-property('To') against : http://localhost:9000.* does not match - skipping child mediato
s
[2015-05-19 09:06:43,582] DEBUG - FilterMediator End : Filter mediator
[2015-05-19 09:06:43,582] DEBUG - InMediator End : In mediator
[2015-05-19 09:06:43,582] DEBUG - OutMediator Start : Out mediator
[2015-05-19 09:06:43,583] DEBUG - OutMediator Current message is a request - skipping child mediators
[2015-05-19 09:06:43,583] DEBUG - OutMediator End : Out mediator
[2015-05-19 09:06:43,584] DEBUG - SequenceMediator End : Sequence <main>
Can someone explain to me why the data is not coming back.We have open the ports to the server the service resides, which is port 8080.
Thanks
It seems that you´re pointing to the wrong URL in ESB. The log shows a message received for the folowing URI: /services/mediate/mediate. Since your proxy is named "search", it should be something link /services/search.
Also, I see that your http endpoint template is not taking any parameters, which probably is not what you want.
The send mediator should look something like that:
<inSequence>
<!-- Assigns URI-Template var to some value. You could use an expression here too -->
<property name="uri.var.search" value="test"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<html uri-template="http://52.24.50.197:8080/search?q={uri.var.search}" method="GET"/>
</endpoint>
Rather define your endpoint outside the proxy , so in the ESB main console create your endpoint :
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
<http uri-template="http://{uri.var.ip}:8080/{uri.var.servicepath} method="GET">
</http>
</endpoint>
Then try out this proxy :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="search"
transports="https,http,local"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="uri.var.ip" value="52.24.50.197"/>
<property name="uri.var.servicepath" value="search"/>
<send>
<endpoint key="MyHTTPEndpoint"/>
</send>
</inSequence>
<outSequence>
<respond/>
</outSequence>
<faultSequence>
<log level="full" category="DEBUG"/>
</faultSequence>
</target> <description/> </proxy>
So you will be sending the get request to the proxy endpoint , that will forward it to the service , and show response , hopefully.

WSO2 ESB : Aggregate node droppping message after aggregation

I am implementing the Fan out -- Fan in splitter EIP inside a proxy , whereby :
|-----> shoe store-(1-M)-------------
productSearchRq -- |-->Rs
|-----> ack clothes store-(0-1)------
Shoe store = Data service and Clothes store = Axis 2 service .
So in short I implement the pattern above ; I clone the request , send it , get responses , format them using payloadFactory:
<productDetails>
<productID>$1</productID>
<productName>$2</productName>
<productSize>$3</productSize>
<productColour>$4</productColour>
<productType>$5</productType>
<sourceID>$6</sourceID>
</productDetails>
on both responses ( and iterate [//productDetails , iterate id = iT] on shoe products since it's one to many). Then in the following response handler , I try to aggregate all these productDetails.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="productSearchHandler">
<log level="custom">
<property name="pocSearchRsHandlerSeq reached" value="++++++++++++++=========Aggregating now========+++++++++++++++++=="></property>
</log>
<aggregate id="iT">
<completeCondition>
<messageCount min="-1" max="-1"></messageCount>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<log level="custom" separator=",">
<property name="::::" value="======================= Formatting the Aggregated Responses. ==============="></property>
</log>
<log level="full"></log>
</onComplete>
</aggregate>
<aggregate>
<completeCondition>
<messageCount min="-1" max="-1"></messageCount>
</completeCondition>
<onComplete xmlns:ns="http://org.apache.synapse/xsd" expression="//productDetails">
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchResp> $1 </prod:productSearchResp>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg expression="//productDetails" evaluator="xml"></arg>
</args>
</payloadFactory>
<switch source="get-property('CallType')">
<case regex="SOAP">
<send></send>
</case>
<case regex="REST">
<property name="messageType" value="application/json" scope="axis2" type="STRING"></property>
<send></send>
</case>
<default></default>
</switch>
</onComplete>
</aggregate>
</sequence>
The filter's there to cater for the API implementation of this proxy. And I do need 2 aggregators because I use a clone AND iterator mediator.
So I am wondering why before my second aggregator , the message is being "reset" to an empty soap message and therefore the 2nd agg fails to find //productDetails. See following log entries :
After 1st agg which aggregates shoe prods:
TID: [0] [ESB] [2015-02-27 09:46:24,520] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Merging message : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> using XPath : //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,522] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Merged result : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,523] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Merging message : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> using XPath : //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,525] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Merged result : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
Then as we are going into 2nd agg :
TID: [0] [ESB] [2015-02-27 09:46:24,545] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Generating Aggregated message from : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><noItemFound>No item in Ackerman's</noItemFound></productDetails></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,547] DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Merging message : <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body></soapenv:Body></soapenv:Envelope> using XPath : //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
TID: [0] [ESB] [2015-02-27 09:46:24,550] ERROR {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Error evaluating expression: //productDetails {org.apache.synapse.mediators.eip.aggregator.AggregateMediator}
What I want is to merge
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails></soapenv:Body></soapenv:Envelope>
with
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><productDetails><noItemFound>No item in Ackerman's</noItemFound></productDetails></soapenv:Body></soapenv:Envelope>
Hi if you are using clone mediator with one aggregate mediator you can aggregate the response from two different services. check this tutorial how that works
http://architects.dzone.com/articles/wso2-esb-cloning-and

Error while invoking wso2 data service from wso2 esb sequence

I am trying to get some data from wso2 data service via wso2 esb sequence as below
<sequence xmlns="http://ws.apache.org/ns/synapse" name="ConcurGetSAEExtractFlow">
<log level="custom">
<property name="Debugging" value="ConcurGetSAEExtractFlow" />
</log>
<xslt key="GetConcurSAE_Extract_Transformation" />
<property name="post-data-service-sequence" value="ConcurTransformSAEExtractFlow" />
<property name="OUT_ONLY" value="false" />
<send receive="DataServiceInvocationErrorFlow">
<endpoint key="ConcurDataServiceEndpoint" />
</send>
<description />
</sequence>
The xslt transformation GetConcurSAE_Extract_Transformation is as below
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dat="http://ws.wso2.org/dataservice" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" version="1.0">
<xsl:template match="/">
<xsl:element name="dat:GetConcurSAEExtract">
</xsl:element>
</xsl:template>
</xsl:stylesheet>
As seen there is no input mappings for the service and output mappings are provided. I have already tested the service in the wso2 dss "try this service" and it runs well.
But whereas when I am trying to run this through the wso2 esb through a proxy I receive the below error block
TID: [] [WSO2 ESB] [2013-01-25 01:26:24,244] INFO {org.apache.synapse.mediators.builtin.LogMediator} - Debugging = ConcurGetSAEExtractFlow {org.apache.synapse.mediators.builtin.LogMediator}
TID: [] [WSO2 ESB] [2013-01-25 01:26:24,252] WARN {org.apache.synapse.transport.nhttp.ClientHandler} - Received an internal server error : Internal Server Error For : 10.12.46.5:9764 For Request : Axis2Request [Message ID : urn:uuid:2b34a4c3-796e-410b-aa62-47f28f88f8b7] [Status Completed : true] [Status SendingCompleted : true] {org.apache.synapse.transport.nhttp.ClientHandler}
TID: [] [WSO2 ESB] [2013-01-25 01:26:24,253] INFO {org.apache.axis2.builder.BuilderUtil} - OMException in getSOAPBuilder {org.apache.axis2.builder.BuilderUtil}
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found html
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:728)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.synapse.transport.nhttp.ClientWorker.run(ClientWorker.java:223)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
TID: [] [WSO2 ESB] [2013-01-25 01:26:24,254] INFO {org.apache.axis2.builder.BuilderUtil} - Remaining input stream :[] {org.apache.axis2.builder.BuilderUtil}
TID: [] [WSO2 ESB] [2013-01-25 01:26:24,254] WARN {org.apache.synapse.transport.nhttp.ClientWorker} - Unexpected response received. HTTP response code : 500 HTTP status : Internal Server Error exception : First Element must contain the local name, Envelope , but found html {org.apache.synapse.transport.nhttp.ClientWorker}
TID: [] [WSO2 ESB] [2013-01-25 01:26:24,273] INFO {org.apache.synapse.mediators.builtin.LogMediator} - status = success response from DSS {org.apache.synapse.mediators.builtin.LogMediator}
I am not able to find out what's going wrong which results in this kind of error.Please if anybody have an idea on this.
You're not copying the soap envelope and header with your XSLT. Make once a <log level="full"/> before and after your <xslt> call, then you'll see that your XSLT will also get a <soap:envelope><soap:body>...
So you'll have to put that in the output as well.
Pseudo code:
<xsl:template match="envelope|body">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy/>
</xsl:template>