I'm trying to use WS02 ESB 5.0 to call a web service every 15 seconds, so I have this task:
<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz" name="UpdateName" xmlns="http://ws.apache.org/ns/synapse">
<trigger cron="0/15 * * * * ?" />
<property name="message"
xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<def:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:def="http://DefaultNamespace" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xsi:type="xsd:string">usr</id>
<pw xsi:type="xsd:string">pwd</pw>
</def:login>
</property>
<property name="sequenceName" value="main"
xmlns:task="http://www.wso2.org/products/wso2commons/tasks" />
<property name="injectTo" value="sequence"
xmlns:task="http://www.wso2.org/products/wso2commons/tasks" />
</task>
And this sequence:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="main" xmlns="http://ws.apache.org/ns/synapse">
<in>
<send>
<endpoint>
<wsdl port="SakaiLogin" service="SakaiLoginService" trace="disable"
uri="http://myserver/sakai-axis/SakaiLogin.jws?wsdl" />
</endpoint>
</send>
</in>
<out>
<send />
</out>
<log level="full" />
</sequence>
Both from the examples shown in the documentation:
https://docs.wso2.com/display/ESB500/Adding+and+Scheduling+Tasks (See "Injecting the message to a named sequence or proxy service").
https://docs.wso2.com/display/ESB500/Sample+56:+Using+a+WSDL+Endpoint+as+the+Target+Endpoint (See "Building the sample").
However, I'm getting this error once I start the Carbon WSO2 ESB server:
[2017-01-27 17:03:45,005] ERROR - InMediator Runtime error occurred while mediating the message
java.lang.NullPointerException
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.isTransportSwitching(Axis2SynapseEnvironment.java:783)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:545)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:382)
at org.apache.synapse.endpoints.WSDLEndpoint.send(WSDLEndpoint.java:75)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:121)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.filters.InMediator.mediate(InMediator.java:74)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.MediatorWorker.run(MediatorWorker.java:80)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
[2017-01-27 17:03:45,023] INFO - LogMediator To: ,
MessageID: urn:uuid:097fb69e-6461-428e-ac85-93cfde65d02e,
Direction: request,
MESSAGE = Executing default 'fault' sequence,
ERROR_CODE = 0,
ERROR_MESSAGE = Runtime error occurred while mediating the message, Envelope:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<def:login xmlns:def="http://DefaultNamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<id xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">usr</id>
<pw xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">pwd</pw>
</def:login></soapenv:Body></soapenv:Envelope>
Can anybody give me a clue of what is going on?
Much appreciated!
In the wsdl endpoint the uri value must be the WSDL address, not the service endpoint:
WSDL URI The URI of the WSDL. Click Test to test the URI.
So, the WSDL endpoint inside the send mediator extracts the service endpoint from the WSDL document using the service and port name to find it inside the wsdl document.
UPDATE 1:
My task config xml:
<?xml version="1.0" encoding="UTF-8"?>
<task xmlns="http://ws.apache.org/ns/synapse"
name="UpdateName"
class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz">
<trigger cron="0/15 * * * * ?"/>
<property name="proxyName" value="testTask"/>
<property name="message">
<moc:QRY_SELECT_SRH_EMPLEADO xmlns:moc="http://www.example.org/mockWS/">
<INT_ID>gero et</INT_ID>
</moc:QRY_SELECT_SRH_EMPLEADO>
</property>
<property name="soapAction"
value="http://www.example.org/mockWS/QRY_SELECT_SRH_EMPLEADO"/>
<property name="injectTo" value="proxy"/>
</task>
My sequence named main1:
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="main1">
<in>
<header name="Action" scope="default" value="http://www.example.org/mockWS/QRY_SELECT_SRH_EMPLEADO"/>
<send>
<endpoint>
<wsdl service="mockWS"
port="mockWSSOAP"
uri="http://localhost:8088/mockmockWSSOAP?wsdl"/>
</endpoint>
</send>
</in>
<out>
<log level="full"/>
<drop/>
</out>
</sequence>
And finally I created a proxy with the same logic because a issue with the drop mediator inside a sequence:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testTask"
transports="https http"
startOnLoad="true">
<target>
<inSequence>
<header name="Action" scope="default" value="http://www.example.org/mockWS/QRY_SELECT_SRH_EMPLEADO"/>
<send>
<endpoint>
<wsdl service="mockWS"
port="mockWSSOAP"
uri="http://localhost:8088/mockmockWSSOAP?wsdl"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<drop/>
</outSequence>
<faultSequence/>
</target>
</proxy>
Related
I have a SOAP proxy service with a Data Mapper to create the output.
The created response does not have the soap envelope tag.
If I try to add the envelope with the payload factory, it strips out the envelope (but it keeps the Body element).
I'm using the WSO2 EI 6.4.0.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="EstrattoContoEntiTributi" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
...
<send>
<endpoint key="..."/>
</send>
</inSequence>
<outSequence>
<datamapper .../>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
We need to use a property mediator as below.
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="PF2"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<payloadFactory media-type="xml">
<format>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://services.samples/xsd"
xmlns:ser="http://services.samples">
<soap:Header/>
<soap:Body>
<ser:getQuote>
<ser:request>
<xsd:symbol>IBM</xsd:symbol>
</ser:request>
</ser:getQuote>
</soap:Body>
</soap:Envelope>
</format>
<args/>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="text/xml"/>
<log level="full">
<property name="ChangedEnve" value="----Changed-------"/>
</log>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
Hope this helps,
https://medium.com/#isuruuy/how-to-construct-a-payload-with-the-soap-envelope-ce8df5032dda
We have created proxy service in wso2 esb using esb project in eclipse.
We have two web service calls and a data mapper.
proxy service is giving error "2017-02-23 12:06:32,131 [-] [HTTP-Listener I/O dispatcher-4] WARN SourceHandler Connection time out after request is read: http-incoming-40 Socket Timeout : 180000 Remote Address : /10.65.0.75:52864" as we add data mapper.
Without data mapper proxy service is running successfully. some times it also runs successfully with data mapper.
can someone guide about this issue?
Following is the proxy source
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EslSfaOFAOMSOIntegrationPS"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<call>
<endpoint>
<address format="soap11"
uri="http://10.1.6.175:9763/services/EslSfaOMSODataService.SOAP11Endpoint/"/>
</endpoint>
</call>
<log level="full"/>
<datamapper config="gov:datamapper/EslSfaOFAOMSOIntegrationMapping.dmc"
inputSchema="gov:datamapper/EslSfaOFAOMSOIntegrationMapping_inputSchema.json"
inputType="XML"
outputSchema="gov:datamapper/EslSfaOFAOMSOIntegrationMapping_outputSchema.json"
outputType="XML"/>
<log description="" level="full"/>
<header name="Authorization"
scope="transport"
value="Basic --"/>
<log level="full"/>
<call>
<endpoint>
<address format="soap11"
uri="https://oraclefusionhost:443/soa-infra/services/default/DooDecompReceiveOrderExternalComposite/ReceiveOrderRequestService"/>
</endpoint>
</call>
<log level="full"/>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<description/>
</proxy>
calling proxy through scheduled task, attached is the source
<task class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz" name="testtask2">
<trigger count="1" interval="60"/>
<property name="proxyName" value="EslSfaOFAOMSOIntegrationPS" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="soapAction" value="operation" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="injectTo" value="proxy" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<soapenv:Envelope xmlns:esl="esl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<esl:operation/>
</soapenv:Body>
</soapenv:Envelope>
</property>
</task>
Secondly how can we have the response from proxy service. our web-service create record in db and return status success when run stand alone form soap ui.
Replace <drop/> with a <respond />
I use WSO2 ESB (4.8.1) and would like to know how to get the output as shown in the "Expected output" block.
Thanks in advance.
Proxy service definition:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="DATA_WS"
transports="https,http"
statistics="disable"
trace="enable"
startOnLoad="true">
<target>
<inSequence>
<switch xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
source="local-name(/*/*/*[1])">
<case regex="getSavProducts">
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice">
<soapenv:Header/>
<soapenv:Body>
<dat:getSavProducts/>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="custom">
<property name="operation" value="getSavProducts"/>
</log>
<send>
<endpoint>
<address uri="http://dssserver:9783/services/DATA_WS/getSavProducts"/>
</endpoint>
</send>
</case>
<default/>
</switch>
</inSequence>
<outSequence>
<iterate xmlns:m="http://ws.wso2.org/dataservice"
id="iter1"
expression="//m:Entries/m:Entry">
<target>
<sequence>
<log level="custom">
<property name="output111" expression="//m:PRODUCT_DESC/text()"/>
</log>
<send/>
</sequence>
</target>
</iterate>
</outSequence>
</target>
<publishWSDL key="gov:/IB/DATA_WS.wsdl"/>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="disableOperationValidation">true</parameter>
<description/>
</proxy>
this is the output i get when calling the service
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Entry xmlns="http://ws.wso2.org/dataservice">
<PRODUCT_CODE>2</PRODUCT_CODE>
<SUB_PRODUCT_CODE>20</SUB_PRODUCT_CODE>
<PRODUCT_DESC>TEST SUB PRODUCT</PRODUCT_DESC>
<STATUS>A</STATUS>
<PRODUCT_CATEGORY>G</PRODUCT_CATEGORY>
<PRODUCT_NAME>General</PRODUCT_NAME>
<CUR_CODE>GBP</CUR_CODE>
<CHANNEL>USSD</CHANNEL>
</Entry>
</soapenv:Body>
</soapenv:Envelope>
log
TID: [0] [ESB] [2016-10-31 10:39:33,761] INFO {org.apache.synapse.mediators.builtin.LogMediator} - output111 = TEST SUB PRODUCT {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2016-10-31 10:39:33,761] INFO {org.apache.synapse.mediators.builtin.LogMediator} - output111 = TEST SUB PRODUCT 2 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2016-10-31 10:39:33,768] INFO {org.apache.synapse.mediators.builtin.LogMediator} - output111 = TEST SUB PRODUCT 3 {org.apache.synapse.mediators.builtin.LogMediator}
Expected output
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:getSavProductsResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="DATA_WS">
<return xsi:type="ns2:dbconncyberfin_DbtSavProdcutTab" xmlns:ns2="http://dbconncyberfin/DATA_WS.xsd">
<array xsi:type="ns3:Array" ns3:arrayType="ns2:dbconncyberfin_DbtSavProdcutUser[16]" xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/">
<item xsi:type="ns2:dbconncyberfin_DbtSavProdcutUser">
<channel xsi:type="xsd:string">USSD</channel>
<curCode xsi:type="xsd:string">EUR</curCode>
<productCategory xsi:type="xsd:string">G</productCategory>
<productCode xsi:type="xsd:string">2</productCode>
<productDesc xsi:type="xsd:string">TEST SUB PRODUCT</productDesc>
<productName xsi:type="xsd:string">General</productName>
<status xsi:type="xsd:string">A</status>
<subProductCode xsi:type="xsd:string">20</subProductCode>
</item>
<item xsi:type="ns2:dbconncyberfin_DbtSavProdcutUser">
<channel xsi:type="xsd:string">USSD</channel>
<curCode xsi:type="xsd:string">USD</curCode>
<productCategory xsi:type="xsd:string">G</productCategory>
<productCode xsi:type="xsd:string">2</productCode>
<productDesc xsi:type="xsd:string">TEST SUB PRODUCT 2</productDesc>
<productName xsi:type="xsd:string">General</productName>
<status xsi:type="xsd:string">A</status>
<subProductCode xsi:type="xsd:string">54</subProductCode>
</item>
<item xsi:type="ns2:dbconncyberfin_DbtSavProdcutUser">
<channel xsi:type="xsd:string">USSD</channel>
<curCode xsi:type="xsd:string">SLR</curCode>
<productCategory xsi:type="xsd:string">G</productCategory>
<productCode xsi:type="xsd:string">1</productCode>
<productDesc xsi:type="xsd:string">TEST SUB PRODUCT 3</productDesc>
<productName xsi:type="xsd:string">General</productName>
<status xsi:type="xsd:string">A</status>
<subProductCode xsi:type="xsd:string">00</subProductCode>
</item>
</array>
</return>
</ns1:getSavProductsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
solved it using xsl with xslt mediator.
item1.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:m="http://ws.wso2.org/dataservice" version="2.0" exclude-result-prefixes="m fn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="DATA_WS">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<ns1:getSavProductsResponse>
<return xsi:type="ns2:dbconncyberfin_DbtSavProdcutTab" xmlns:ns2="http://dbconncyberfin/DATA_WS.xsd">
<array xsi:type="ns3:Array" ns3:arrayType="ns2:dbconncyberfin_DbtSavProdcutUser[16]" xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:for-each select="//m:Entries/m:Entry">
<item xsi:type="ns2:dbconncyberfin_DbtSavProdcutUser">
<channel xsi:type="xsd:string"><xsl:value-of select="m:CHANNEL"/></channel>
<curCode xsi:type="xsd:string"><xsl:value-of select="m:CUR_CODE"/></curCode>
<productCategory xsi:type="xsd:string"><xsl:value-of select="m:PRODUCT_CATEGORY"/></productCategory>
<productCode xsi:type="xsd:string"><xsl:value-of select="m:PRODUCT_CODE"/></productCode>
<productDesc xsi:type="xsd:string"><xsl:value-of select="m:PRODUCT_DESC"/></productDesc>
<productName xsi:type="xsd:string"><xsl:value-of select="m:PRODUCT_NAME"/></productName>
<status xsi:type="xsd:string"><xsl:value-of select="m:STATUS"/></status>
<subProductCode xsi:type="xsd:string"><xsl:value-of select="m:SUB_PRODUCT_CODE"/></subProductCode>
</item>
</xsl:for-each>
</array>
</return>
</ns1:getSavProductsResponse>
</xsl:template>
outSequence
<outSequence>
<xslt key="gov:/xslt/item1.xsl"/>
<enrich>
<source type="body" clone="true"/>
<target type="property" property="original"/>
</enrich>
<payloadFactory media-type="xml">
<format>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body/>
</SOAP-ENV:Envelope>
</format>
<args/>
</payloadFactory>
<enrich>
<source type="property" clone="true" property="original"/>
<target type="body"/>
</enrich>
<send/>
</outSequence>
I am using WSO2 ESB to send a JMS message (XML payload) to an endpoint and then to read a return JMS message (on another queue) from the same endpoint (which also sends an XML payload). The problem I am facing is that the return JMS message from the endpoint, even though it is an XML payload, comes in as a text message.
Here is what I see in WSO2 for the JMS message (with XML payload) sent back by the endpoint:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<axis2ns2:text xmlns:axis2ns2="http://ws.apache.org/commons/ns/payload">
<?xml version="1.0" encoding="UTF-8"?>
<Sys1Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Sys1-ack-nack.xsd">
<security>
<statusInfo>
<ARMStatus>ARM_ACK</ARMStatus>
<Sys1Status>Sys1_ACK</Sys1Status>
<FinalStatus>ACK</FinalStatus>
</statusInfo>
<upstreamIdentifier>
<tradeId>459609</tradeId>
<messageId>12345678</messageId>
<assetId>6M2</assetId>
<issueDescription>IRS RTP 3.12 19MAY11 JP</issueDescription>
<productType>SWAPTION</productType>
</upstreamIdentifier>
</security>
</Sys1Response>
</axis2ns2:text>
</soapenv:Body>
</soapenv:Envelope>
This is the WSO2 proxy definition.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.ESBRegistry">
<parameter name="localRegistry">/</parameter>
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="ToWSO2"
transports="jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="transport.jms.ContentTypeProperty"
value="Content-Type"
scope="axis2"/>
<log level="full"/>
<call>
<endpoint>
<address uri="jms:/ToSys1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue&transport.jms.ReplyDestinationType=queue&transport.jms.ReplyDestination=FromSys1&transport.jms.ContentType=application/xml"/>
</endpoint>
</call>
<log level="full"/>
</inSequence>
<outSequence>
<log level="full"/>
<drop/>
</outSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.Destination">ToWSO2</parameter>
</proxy>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="main">
<in>
<log level="full"/>
<filter source="get-property('To')" regex="http://localhost:9000.*">
<send/>
</filter>
</in>
<out>
<send/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
</definitions>
Would appreciate help in resolving this. Many thanks in advance!
I am using wso2esb4.8.0
I wish to transform the message using wso2esb .Actaulle need to add Complex Element to Payload
How would i achive this.
my Client request is
<?xml version="1.0" encoding="UTF-8"?>
But my Adapter endpoint will allow the request in this format.If it is for one operation i may follow payload mediator to make my request But those are bumch of requests
so Endpoint allowing request is
Just extract the Operation_Name and adding it as Complex Element But I am unable to do it I am trying in Proxy like this
Proxy is
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SamplePOC7"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property xmlns:open="http://www.openuri.org/"
xmlns:ns="http://org.apache.synapse/xsd"
xmlns:env="http://eai.mmn.mm/Envelope"
xmlns:poin="http://eai.mm.mm/gg"
name="Operation_Name"
expression="//poin:Operation_Name/text()"
scope="default"
type="STRING"/>
<property xmlns:open="http://www.openuri.org/"
xmlns:ns="http://org.apache.synapse/xsd"
xmlns:env="http://eai.mmn.xxxx/Envelope"
name="AddElement"
expression="concat('open:',get-property('Operation_Name'))"
scope="default"
type="STRING"/>
<enrich>
<source xmlns:env="http://eai.mmn.mm/Envelope"
clone="true"
xpath="//env:Payload/*"/>
<target xmlns:poin="http://eai.mm.XXX/gg"
xpath="concat('open:',//poin:Operation_Name/text())"/>
</enrich>
<log level="full">
<property name="Message" expression="get-property('AddElement')"/>
</log>
</inSequence>
<outSequence/>
</target>
<description/>
</proxy>
But its giving errors like the below my error log is
[2014-05-15 10:53:48,167] INFO - ProxyService Successfully created the Axis2 se
rvice for Proxy service : SamplePOC7
[2014-05-15 10:53:53,089] ERROR - EnrichMediator Invalid Target object to be enr
ich.
[2014-05-15 10:54:19,160] INFO - ProxyService Building Axis service for Proxy s
With which mediator i can extract this request as per my desire way please if you know paste configuration or else provide any example
Thanks in advance
You can use XSLT mediator or JavaScript
A sample proxy with javascript doing what you want :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestSOF"
transports="http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property xmlns:open="http://www.openuri.org/"
xmlns:ns="http://org.apache.synapse/xsd"
xmlns:poin="http://eai.mtn.iran/PointOfSales"
name="Operation_Name"
expression="//poin:Operation_Name/text()"
scope="default"
type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
xmlns:poin="http://eai.mtn.iran/PointOfSales"
name="PointOfSales"
expression="//poin:PointOfSales"
scope="default"
type="STRING"/>
<script language="js"><![CDATA[
mc.setPayloadXML(<open:{mc.getProperty("Operation_Name")} xmlns:open="http://www.openuri.org/">
{new XML(mc.getProperty("PointOfSales"))}
</open:{mc.getProperty("Operation_Name")}>);
]]></script>
<log level="full"/>
</inSequence>
</target>
</proxy>
A sample using XSLT :
<?xml version="1.0" encoding="UTF-8"?>
<localEntry xmlns="http://ws.apache.org/ns/synapse" key="SOFXSL">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:open="http://openuri.org/"
xmlns:env="http://eai.mtnn.iran/Envelope"
xmlns:poin="http://eai.mtn.iran/PointOfSales"
version="2.0">
<xsl:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="no"/>
<xsl:param name="operationname"/>
<xsl:template match="/">
<xsl:element name="open:{$operationname}">
<xsl:apply-templates select="//poin:PointOfSales"/>
</xsl:element>
</xsl:template>
<xsl:template match="#*|*|comment()">
<xsl:copy>
<xsl:apply-templates select="#*|*|text()|comment()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<description/>
</localEntry>
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestSOF"
transports="http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<property xmlns:open="http://www.openuri.org/"
xmlns:ns="http://org.apache.synapse/xsd"
xmlns:poin="http://eai.mtn.iran/PointOfSales"
name="Operation_Name"
expression="//poin:Operation_Name/text()"
scope="default"
type="STRING"/>
<xslt key="SOFXSL">
<property name="operationname" expression="get-property('Operation_Name')"/>
</xslt>
<log level="full"/>
</inSequence>
</target>
</proxy>