I am Using Wso2esb4.8.0 I wish to transform the messages as per the Adapter request requirement. My incoming messages in various ways. Like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:open="http://www.openuri.org/" xmlns:env="http://eai.mmn.gg/Envelope" xmlns:par="http://eai.mm.gg/par">
<soapenv:Header/>
<soapenv:Body>
<open:clientRequest>
<env:EaiEnvelope>
<env:Domain>1</env:Domain>
<env:Service>par</env:Service>
<env:ServiceId>1</env:ServiceId>
<env:Language>En</env:Language>
<env:uiId>sd</env:uiId>
<env:sid>sd</env:sid>
<env:MessageId>2210201395544</env:MessageId>
<env:CorrelationId>1</env:CorrelationId>
<env:GenTimeStamp>1</env:GenTimeStamp>
<env:SentTimeStamp>1</env:SentTimeStamp>
<env:Payload>
<par:par>
<par:Request>
<par:Operation_Name>getv</par:Operation_Name>
</par:Request>
</par:par>
</env:Payload>
</env:EaiEnvelope>
</open:clientRequest>
</soapenv:Body>
</soapenv:Envelope>
Above one is 1 type of message for every message Namespace will be change. One more sample Request message like this.In this way we have 10-15 request messages
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:open="http://www.openuri.org/" xmlns:env="http://eai.mmn.gg/Envelope" xmlns:acc="http://eai.mm.gg/accounts">
<soapenv:Header/>
<soapenv:Body>
<open:clientRequest>
<env:EaiEnvelope>
<env:Service>par</env:Service>
<env:Language>En</env:Language>
<env:uiId>sd</env:uiId>
<env:sid>sd</env:sid>
<env:MessageId>2210201395544</env:MessageId>
<env:CorrelationId>1</env:CorrelationId>
<env:GenTimeStamp>1</env:GenTimeStamp>
<env:SentTimeStamp>1</env:SentTimeStamp>
<env:Payload>
<acc:par>
<acc:Request>
<acc:CustDetails_InputData>
<acc:MSISDN>989105496</acc:MSISDN>
</acc:CustDetails_InputData>
<acc:Operation_Name>getv</acc:Operation_Name>
</acc:Request>
</acc:par>
</env:Payload>
</env:EaiEnvelope>
</open:clientRequest>
</soapenv:Body>
</soapenv:Envelope>
In every Payload data has been keep changing so requirement is write single Xquery for all the request to convert to desire format. Out put like this for above message after Xquery transformation.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:open="http://www.openuri.org/" xmlns:acc="http://eai.mm.kman/acf">
<soapenv:Header/>
<soapenv:Body>
<open:getv>
<acc:acf>
<!--You have a CHOICE of the next 3 items at this level-->
<acc:Request>
<acc:Operation_Name>getv</acc:Operation_Name>
<acc:BasicInfo>
<acc:Language>En</acc:Language>
<acc:h>sd</acc:h>
<acc:sid>sd</acc:sid>
<acc:MessageId>2210201395544</acc:MessageId>
<acc:Operation>getv</acc:Operation>
</acc:BasicInfo>
<acc:CustDetails_InputData>
<acc:MSISDN>989352105496</acc:MSISDN>
</acc:CustDetails_InputData>
</acc:Request>
</acc:acf>
</open:getv>
</soapenv:Body>
</soapenv:Envelope>
One more request message Output after XQuery transformation is .
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:open="http://www.openuri.org/" xmlns:par="http://eai.mm.kman/par">
<soapenv:Header/>
<soapenv:Body>
<open:getv>
<par:par>
<par:Request>
<par:BasicInfo>
<par:Language>En</par:Language>
<par:uiId>sd</par:uiId>
<par:sid>sd</par:sid>
<par:MessageId>201395544</par:MessageId>
<par:Operation>getv</par:Operation>
</par:BasicInfo>
<par:Operation_Name>getv</par:Operation_Name>
</par:Request>
</par:par>
</open:getv>
</soapenv:Body>
</soapenv:Envelope>
For this I have tried my best but I am unable to get it I have tried like this my below configuration is XQuery
<x xmlns="http://ws.apache.org/ns/synapse">
<![CDATA[
declare namespace soapenv = "http://schemas.xmlsoap.org/soap/envelope";
declare namespace open="http://www.openuri.org/";
{
element {$POS}{
element {$Req_1}{
element {fn:concat(prefix-from-QName(node-name($payload/*[1])),':hh')}{
}
}
}
]]></x>
But I am getting errors in wso2esb log my Proxy Configuration is Proxy
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="XQueryPOC" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="LOG" value="LOG"/>
</log>
<log level="full"/>
</inSequence>
<outSequence/>
</target>
<description/>
</proxy>
So how would I achieve this Using XQuery .The Namespace for every request is changing so We need declare as dynamic.Some body please help me for this
Thanks in Advance.