Preserve the original payload when calling a web service - wso2

I am struggling to figure out how to preserve a payload so that it is available after calling a web service within a sequence.
For example in the following sequence, after the “call” mediator fires the payload changes to what has been returned by the web service.
What I am looking to do is to enrich the original payload with the data that has been returned from the web service call.
All help is very much appreciated.
<log level="full"/>
<payloadFactory media-type="xml">
<format>
<Flight xmlns="">
<location_id>$1</location_id>
<FlightDistance/>
<Aircraft>
<AircraftAbbr/>
<LandingDistance/>
<TakeoffDistance/>
<AircraftRange/>
<AirframeHours/>
</Aircraft>
<Runways>
<Airport/>
</Runways>
</Flight>
</format>
<args>
<arg evaluator="xml" expression="get-property('OriginAirport')"/>
</args>
</payloadFactory>
<log level="full">
<property expression="get-property('OriginalPayload')" name="OriginalPayload"/>
</log>
<call blocking="true" description="">
<endpoint key="GetRunways"/>
</call>
<foreach expression="//d:Entries/d:Entry" id="feid" xmlns:d="http://ws.wso2.org/dataservice">
<sequence>
<log description="" level="full">
<property name="marker" value="marker"/>
</log>
<property expression="$body/Entry/runway_length" name="RunwayLength" scope="default" type="STRING"/>
<enrich>
<source clone="true" property="RunwayLength" type="property"/>
<target action="child" property="RunwayLength" type="property"/>
</enrich>
<log>
<property expression="get-property('RunwayLength')" name="PropertyValue"/>
</log>
</sequence>
</foreach>

use enrich mediator and store the payload in to property
<enrich>
<source type="body"/>
<target type="property" property="REQUEST_PAYLOAD"/>
</enrich>
https://docs.wso2.com/display/ESB481/Enrich+Mediator

To complete #Jenananthan answer:
Store original payload in a property
Call the webservice
Restore the original payload to body:
<enrich>
<source clone="false" type="property" property="ORIGINAL_PAYLOAD"/>
<target action="replace" type="body"/>
</enrich>

Related

Put request doen't reach backend api

I'm trying to send a put request to my backend api, but I need a token and its working on the get request so the problem isn't with the token but when I make the request the response is 202 accepted and don't update the database.
Here is the code
<resource methods="PUT" uri-template="/Nurse">
<inSequence>
<enrich>
<source clone="true" type="body"/>
<target property="payload" type="property"/>
</enrich>
<property action="remove" name="REST_URL_POSTFIX" scope="axis2"/>
<call blocking="true" description="">
<endpoint>
<address format="get" uri="http://192.168.20.1:8280/loginAPI/login"/>
</endpoint>
</call>
<property expression="json-eval($.accessToken)" name="token" scope="default" type="STRING"/>
<property expression="fn:concat('Bearer ',$ctx:token)" name="Authorization" scope="transport" type="STRING"/>
<enrich description="Restore original payload">
<source property="payload" type="property"/>
<target type="body"/>
</enrich>
<send>
<endpoint key="PutNurseEp"/>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
Can anyone help what is the problem here?
Solved the question, the error was on the postman request, I was adding a space on the beggining of the url

How to combine two queries in wso2 esb

I am new with wso2 and probably my problem is very easy, but I've been fighting this for a week. The problem is that I have to combine two payloads in ESB 4.9.0.
I've tried enriching, making new payloadFactory with parameters from previous queries, but it all didn't make it in the way I want. The problem is that I have to get student data from DS and generate password from API (based on student id). All has to be combined in one payload and forwarded to xslt transformation. From DS I'm getting for example this:
<student>
<try>
<st_id>123456</st_id>
<name>Michael</name>
<surname>Smith</surname>
<email>email#email.com</email>
<ssn>123456789</ssn>
<faculty name="IT">
<field>Programming</field>
<f_code>IT-1234-19</f_code>
</faculty>
</try>
</student>
Sometimes student can do only one faculty on one field of study, but some of them do two different faculties:
<student>
<try>
<st_id>121234</st_id>
<name>John</name>
<surname>Doe</surname>
<email>jd#email.com</email>
<ssn>764896536</ssn>
<faculty name="Management">
<field>Production engineering</field>
<f_code>MN-1234-19</f_code>
</faculty>
</try>
<try>
<st_id>121234</st_id>
<name>John</name>
<surname>Doe</surname>
<email>jd#email.com</email>
<ssn>764896536</ssn>
<faculty name="IT">
<field>Electronics</field>
<f_code>IT-4321-19</f_code>
</faculty>
</try>
</student>
API gives me that:
{"HASH":"{SSHA}PTFOuvF/20MrSGbTkQTkeBUC8A/0mfKF"}
Expected result:
To add a HASH anywhere inside the student node f ex:
<student>
<try>
<st_id>123456</st_id>
<name>Michael</name>
<surname>Smith</surname>
<email>email#email.com</email>
<ssn>123456789</ssn>
<faculty name="IT">
<field>Programming</field>
<f_code>IT-1234-19</f_code>
</faculty>
</try>
<hash>{SSHA}PTFOuvF/20MrSGbTkQTkeBUC8A/0mfKF</hash>
</student>
My code is:
<inSequence>
<property expression="json-eval($.Numb)" name="Numb" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<v1:getStudentRequest xmlns:v1="http://localhost/contract/ldap/v1">
<v1:Numb>$1</v1:Numb>
</v1:getStudentRequest>
</format>
<args>
<arg evaluator="xml" expression="get-property('uri.var.Numb')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="urn:getStudentRequest"/>
<call>
<endpoint>
<address uri="http://localhost:9769/services/LdapDS.SOAP11Endpoint" format="soap11"/>
</endpoint>
</call>
<enrich>
<source type="body" clone="true"/>
<target type="property" property="Student"/>
</enrich>
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
<call xmlns:v1="http://localhost/contract/ldap/v1">
<endpoint xmlns:v1="http://localhost/contract/ldap/v1">
<http uri-template="http://localhost:39080/ldap/passgen/{uri.var.Numb}" method="GET" format="pox"></http>
</endpoint>
</call>
<property evaluator="json" name="password" scope="default" expression="json-eval($.HASH)"/>
<filter source="get-property('password')" regex="^$">
<then>
<log level="custom">
<property expression="get-property('Numb')" name="Numb"/>
</log>
</then>
<else>
<property evaluator="json" name="pass" scope="default" expression="json-eval($.HASH)"/>
</else>
</filter>
<!--
<payloadFactory media-type="xml">
<format>
<m0:password xmlns:m0="http://localhost/contract/ldap/v1">$1</m0:password>
</format>
<args>
<arg evaluator="xml" expression="get-property('pass')"/>
</args>
</payloadFactory>
-->
<enrich>
<source xpath="$body" clone="true"/>
<target action="child" type="custom" xpath="$Student//student/try"/>
</enrich>
<enrich>
<source type="property" clone="true" property="Student"/>
<target action="replace" type="body"/>
</enrich>
<xslt key="ldapXSL"/>
<respond/>
</inSequence>
As a result I got just only get a HASH :(
The following contains a sample mediation that meets your requirements. Please refer to the following and develop your mediation. Analyzing the provided configurations it seems there are misconfigurations in the synapse artifacts (ex:-xpath="$Student//student/try") but the logic you have implemented is correct.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log level="full"/>
<call>
<endpoint>
<http uri-template="http://www.mocky.io/v2/5dc6d3963800001c35cdec56"/>
</endpoint>
</call>
<enrich>
<source clone="true" type="body"/>
<target property="property1" type="property"/>
</enrich>
<call>
<endpoint>
<http uri-template="http://www.mocky.io/v2/5dc6d4723800004a00cdec59"/>
</endpoint>
</call>
<property name="messageType" scope="axis2" value="application/xml"/>
<enrich>
<source clone="true" xpath="$body//HASH"/>
<target action="child" xpath="$ctx:property1"/>
</enrich>
<enrich>
<source clone="true" property="property1" type="property"/>
<target type="body"/>
</enrich>
<log level="custom">
<property expression="$ctx:property1" name="**-----**"/>
</log>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
The above proxy consists of the mock backends responses similar to that you have mentioned. Hope this helps

Iteration through Parent-child with endpoint call

Scenario: Request consist of multiple orders with details. Send order details to back-end service and get a new Row number that after I should used like one of param with create details
Request looks:
<OrderList>
<Order>
<target>MySQL</target>
<Sales>
<email>p#gmail.com</email>
</Sales>
<Details>
<Item><qty>1</qty><code>PR9</code></Item>
<Item><qty>2</qty><code>PR8</code></Item>
<Item><qty>3</qty><code>PR7</code></Item>
</Details>
</Order>
<Order>
<target>MySQL</target>
<Sales>
<email>j#gmail.com</email>
</Sales>
<Details>
<Item><qty>4</qty><code>PR6</code></Item>
<Item><qty>5</qty><code>PR5</code></Item>
<Item><qty>6</qty><code>PR4</code></Item>
</Details>
</Order>
.......
</OrderList>
sequence:
<inSequence>
<!-- get source target data -->
<iterate expression="//Order" preservePayload="true">
<target>
<enrich>
<source clone="true" xpath="//Order"/>
<target property="OrderBackup" type="property"/>
</enrich>
<sequence>
<property expression="//target" name="SalesTarget" scope="default" type="STRING"/>
<property expression="//Sales/email" name="email" scope="default" type="STRING"/>
<filter regex="MySQL" source="$ctx:SalesTarget">
<then>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<dat:addSalesOrder>
<dat:email>$1</dat:email>
</dat:addSalesOrder>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="$ctx:email"/>
</args>
</payloadFactory>
<call blocking="true">
<endpoint key="SalesOrderEP"/>
</call>
**<enrich>
<source clone="true" type="body"/>
<target property="newRowID" type="property"/>
</enrich>**
<property expression="$ctx:newRowID > 0 " name="isCorrectResponse" scope="default" type="BOOLEAN"/>
<filter regex="true" source="$ctx:isCorrectResponse">
<then>
<enrich>
<source clone="true" property="OrderBackup" type="property"/>
<target type="body"/>
</enrich>
<iterate expression="//Details">
<target>
<sequence>
<property expression="//qty" name="qty" scope="default" type="STRING"/>
<property expression="//code" name="code" scope="default" type="STRING"/>
<log level="custom">
<property expression="fn:concat('params:Code: ' ,$ctx:code, ' ;Qty: ',$ctx:qty)" name="info"/>
</log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:dat="http://ws.wso2.org/dataservice" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<dat:addSalesDetails>
<dat:salesId>$1</dat:salesId>
<dat:qty>$2</dat:qty>
<dat:code>$3</dat:code>
</dat:addSalesDetails>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="$ctx:newRowID"/>
<arg evaluator="xml" expression="$ctx:qty"/>
<arg evaluator="xml" expression="$ctx:code"/>
</args>
</payloadFactory>
<call blocking="true">
<endpoint key="SalesDetailsEP"/>
</call>
<!-- get response and log it -->
<aggregate>
<completeCondition>
<messageCount max="-1" min="-1"/>
</completeCondition>
<onComplete expression="//m0:UpdatedRowCount/Value" xmlns:m0="http://ws.wso2.org/dataservice">
<log level="full"/>
<drop/>
</onComplete>
</aggregate>
</sequence>
</target>
</iterate>
</then>
<else/>
</filter>
</then>
<else/>
</filter>
</sequence>
</target>
</iterate>
</inSequence>
I have a problem with first call response ... I used
<enrich>
<source clone="true" type="body"/>
<target property="newRowID" type="property"/>
</enrich>
to save newly created row Id in property and I'm getting it correctly in line
> <log level="custom">
> <property expression="fn:concat('NewRowID = ' ,$ctx:newRowID)" name="info"/>
> </log>
BUT when I want to use it in second payload it looks it cannot resolve it ?!!?
error:
DS Fault Message: Error in 'CallQuery.extractParams', cannot find
parameter with type:query-param name:salesId DS Code:
INCOMPATIBLE_PARAMETERS_ERROR
I figure out that in payload the $ctx:newRowID is reolved as
<GeneratedKeys> xmlns="http://ws.wso2.org/dataservice"><Entry><ID>93</ID></Entry></GeneratedKeys>
and not simply as 93
I'm guessing this is because in enrich I used source as "body" .. but when I tried to get xpath of response like xpath = "//Entry/ID" I got nothing
what is wrong?
Problem was that enrich mediator need namespace so
<enrich>
<source clone="true" xmlns:n0="http://ws.wso2.org/dataservice" xpath="$body/n0:GeneratedKeys/n0:Entry/n0:ID"/>
<target property="newRowID" type="property"/>
</enrich>
did the magic ... So ALWAYS put a namespace lesson learned

Enriching the response array with the corresponding elements in the request array

Input request :
[
{
"id" : "1",
"make" : "NAHB"
},
{
"id" : "2",
"make" : "Honda"
},
{
"id" : "3",
"make" : "Samsung"
}
]
I am using iterate, to send each element of above array as request to a backend service( In myactual project this is not so simple service i.e. its reponse is very complex with lots of arrays and sub-arrays(child arrays)in it . for better understanding of issue I kept it like this ).
The responses of the backend service are aggregated in one soap xml by AggregateMediator.
Below is response from AggregateMediator
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Information>
<jsonObject>
<id>3</id>
<name>Mobile</name>
<model>S8</model>
</jsonObject>
<jsonObject>
<id>2</id>
<name>Car</name>
<model>Amaze</model>
</jsonObject>
<jsonObject>
<id>1</id>
<name>Home</name>
<area>5000sqft</area>
</jsonObject>
</Information>
</soapenv:Body>
</soapenv:Envelope>
I want to enrich above response from AggregateMediator like below using input request.
i.e. I want to merge input request and output of backend service.(id is common between them.)
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Information>
<jsonObject>
<id>3</id>
<name>Mobile</name>
<model>S8</model>
<make>Samsung</make>
</jsonObject>
<jsonObject>
<id>2</id>
<name>Car</name>
<model>Amaze</model>
<make>Honda</make>
</jsonObject>
<jsonObject>
<id>1</id>
<name>Home</name>
<area>5000sqft</area>
<make>NAHB</make>
</jsonObject>
</Information>
</soapenv:Body>
</soapenv:Envelope>
I kept input request array in a property before calling backend services and was able to access it in response flow.
but the problem is "both request and response are arrays". How could I run two foreach on two different arrays simultaneously and also match their id before updating each array element of response.
foreachTest.xml :
<?xml version="1.0" encoding="UTF-8"?>
<api context="/foreschTest" name="foreachTest" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST GET" uri-template="/hi">
<inSequence>
<log level="full"/>
<log level="custom">
<property expression="//jsonArray" name="message"/>
</log>
<property expression="//jsonArray" name="req" scope="default" type="STRING"/>
<foreach expression="//jsonArray/jsonElement" id="Loop">
<sequence>
<property expression="get-property('Loop_FOREACH_COUNTER')" name="countid" scope="default" type="STRING"/>
<!-- <enrich>
<source clone="true" property="INCOMING_REQUEST" type="property"/>
<target type="body"/>
</enrich>
<enrich>
<source clone="true" type="inline">
<id xmlns="">Y</id>
</source>
<target action="sibling" xpath="//jsonElement"/>
</enrich> -->
<!--<enrich>
<source clone="true" type="property" property="INCOMING_REQUEST"></source>
<target action="replace" type="body"></target>
</enrich> -->
<!-- Temporily commented <enrich>
<source clone="true" type="inline">
<uniqueId xmlns="">Y</uniqueId>
</source>
<target action="child" xpath="//jsonElement/data[2]"/>
</enrich>
<enrich>
<source clone="true" property="countid" type="property"/>
<target xpath="//jsonElement/data[2]/uniqueId"/>
</enrich> -->
<log level="custom">
<property expression="get-property('countid')" name="mgs7"/>
</log>
<log description="" level="custom">
<property expression="get-property('Loop_FOREACH_ORIGINAL_MESSAGE')" name="mgs5"/>
<property expression="get-property('Loop_FOREACH_COUNTER')" name="mgs6"/>
<property expression="//jsonElement" name="msg8"/>
</log>
<log description="" level="custom">
<property expression="//jsonElement/data[0]" name="msg9"/>
<property expression="//jsonElement/data[1]" name="msg10"/>
<property expression="//jsonElement/data[2]" name="msg11"/>
</log>
</sequence>
</foreach>
<iterate expression="//jsonArray/jsonElement" id="1">
<target>
<sequence>
<log level="custom">
<property name="msg2" value=""Inside iterate""/>
</log>
<log level="full"/>
<send>
<endpoint key="modifyAgrRespEP"/>
</send>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence>
<property name="info" scope="default">
<Information xmlns=""/>
</property>
<aggregate id="1">
<completeCondition>
<messageCount max="-1" min="-1"/>
</completeCondition>
<onComplete enclosingElementProperty="info" expression="//jsonObject">
<log level="custom">
<property name="msg3" value=""Inside Aggr""/>
</log>
<log level="full"/>
<foreach expression="//Information/jsonObject">
<sequence>
<log level="custom">
<property name="msg4" value=""Inside Foreach""/>
</log>
<property expression="$body" name="agr" scope="default" type="STRING"/>
<log level="custom">
<property expression="get-property('agr')" name="agr"/>
</log>
<!-- <log level="full"/> -->
</sequence>
</foreach>
</onComplete>
</aggregate>
</outSequence>
<faultSequence/>
</resource>
</api>
modifyAgrRes.xml :
<?xml version="1.0" encoding="UTF-8"?>
<api context="/mod" name="modifyAgrRes" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST GET" uri-template="/aggr">
<inSequence>
<log level="custom">
<property name="message" value=""Inside Modify Service *************************""/>
</log>
<log level="custom">
<property expression="//jsonObject" name="location"/>
</log>
<switch source="//jsonObject/id">
<case regex="1">
<enrich>
<source clone="true" type="inline">
<name xmlns="">Home</name>
</source>
<target action="child" xpath="//jsonObject"/>
</enrich>
<enrich>
<source clone="true" type="inline">
<area xmlns="">5000sqft</area>
</source>
<target action="child" xpath="//jsonObject"/>
</enrich>
</case>
<case regex="2">
<enrich>
<source clone="true" type="inline">
<name xmlns="">Car</name>
</source>
<target action="child" xpath="//jsonObject"/>
</enrich>
<enrich>
<source clone="true" type="inline">
<model xmlns="">Amaze</model>
</source>
<target action="child" xpath="//jsonObject"/>
</enrich>
</case>
<case regex="3">
<enrich>
<source clone="true" type="inline">
<name xmlns="">Mobile</name>
</source>
<target action="child" xpath="//jsonObject"/>
</enrich>
<enrich>
<source clone="true" type="inline">
<model xmlns="">S8</model>
</source>
<target action="child" xpath="//jsonObject"/>
</enrich>
</case>
<default/>
</switch>
<log level="custom">
<property expression="//jsonObject" name="msg20"/>
</log>
<enrich>
<source clone="true" xpath="//jsonObject"/>
<target type="body"/>
</enrich>
<log level="full"/>
<respond/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</resource>
</api>
Here is a high-level answer; I guess you can work the details out for yourself:
Copy the input ($body) to a new property (inputBody) at the
beginning
Transform $ctx:inputBody to XML - see this URL for an example:
https://docs.wso2.com/display/ESB481/Sample+440%3A+Converting+JSON+to+XML+Using+XSLT
Do all intermediate processing steps
Loop through the $ctx:inputBody property, and for each row,
Get the /id (currentId) and /make (currentMake) into new properties
Use the Enrich mediator to add a child
/Information/jsonObject[id=$ctx:currentId]/make with value set to
$ctx:currentMake
Convert back to JSON if necessary.
I hope that helps.

WSO2 ESB call not passing envelope

I have an API of the form
<api xmlns="http://ws.apache.org/ns/synapse" name="MyRestApi" context="/practice">
<resource methods="GET" uri-template="/{someValue}">
<inSequence>
<header name="Action" value="urn:sayHello"/>
<payloadFactory media-type="xml">
<format>
<p:sayHello xmlns:p="http://practice">
<p:inputString>$1</p:inputString>
</p:sayHello>
</format>
<args>
<arg evaluator="xml" expression="$ctx:uri.var.someValue"/>
</args>
</payloadFactory>
<log level="full"/>
<call>
<endpoint>
<address uri="http://192.168.0.105:9763/services/Practice/sayHello" format="soap12"/>
</endpoint>
</call>
<enrich>
<source type="body" clone="true"/>
<target type="property" action="child" property="body_of_first_call"/>
</enrich>
<property xmlns:ns="http://practice" name="response" expression="//ns:return" scope="default" type="STRING"/>
<property xmlns:ns="http://practice" name="response2" expression="//ns:sayHelloResponse" scope="default" type="STRING"/>
<log>
<property name="myValue" expression="$ctx:response"/>
<property name="myValue2" expression="$ctx:response2"/>
<property name="myValue3" expression="$ctx:body_of_first_call"/>
</log>
<payloadFactory media-type="xml">
<format>
<result>
<sentValue>$1</sentValue>
<returnedValue>$2</returnedValue>
</result>
</format>
<args>
<arg evaluator="xml" expression="$ctx:uri.var.someValue"/>
<arg evaluator="xml" expression="$ctx:response"/>
</args>
</payloadFactory>
<property name="messageType" value="application/xml" scope="axis2" type="STRING"/>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Based almost entirely on a guide found here
It's at this point just an attempt to grasp the concepts of connectors and APIs so I can apply it to what I'm doing at work, but I've hit a snag. Any attempts to communicate with an outside SOAP service, which my ESB will need to do, either fails to find the endpoint or fails to pass on the values in the SOAP envelope.
As written above the code will find the endpoint, but the input value inputString in the request is always null. It's essentially identical to putting that address into your browser which completely omits the SOAP envelope, however logging the call prints the envelope as expected to the console so the envelope is being generated but not making its way to the application server.
Things I have also tried:
1) Changing the endpoint address to be the service endpoint, rather than the specific operation. This causes an error from the AS claiming the operation cannot be found. This endpoint and operation work as expected in SoapUI.
2) Using a WSDL endpoint instead of address. Result is the same as in 1.
3) Adding/removing the header tag. All three endpoints have been tried with/without the header tag. Their results do not change.
At this point I've exhausted my admittedly poor understanding of ESBs.
To invoke my service I set up my mediator this way.
<call blocking="true">
<endpoint>
<address uri="http://169.254.193.10:9769/services/ServicePharmacy" format="soap11"/>
</endpoint>
</call>
the blocking property in true is to do synchronous messaging
<call blocking="true">
</call>
this is my API
<api xmlns="http://ws.apache.org/ns/synapse" name="showByIdCallMediator" context="/getByIdCall">
<resource methods="GET" uri-template="/{Id}">
<inSequence>
<property name="getId" expression="get-property('uri.var.Id')" scope="default" type="STRING"/>
<log>
<property name="ID" expression="get-property('getId')"/>
</log>
<payloadFactory media-type="xml">
<format>
<p:searchPharmacy xmlns:p="http://pharmacy.arce.org">
<ax22:pharmacy xmlns:ax22="http://pharmacy.arce.org">
<xs:id xmlns:xs="http://pharmacy.arce.org/xsd">$1</xs:id>
</ax22:pharmacy>
</p:searchPharmacy>
</format>
<args>
<arg evaluator="xml" expression="get-property('getId')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="urn:searchPharmacy"/>
<call blocking="true">
<endpoint>
<address uri="http://169.254.193.10:9769/services/ServicePharmacy" format="soap11"/>
</endpoint>
</call>
<log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="Status" expression="get-property('axis2','HTTP_SC')"/>
</log>
<log level="full"/>
<enrich>
<source type="body" clone="true"/>
<target type="property" property="Ouput_Respose_Service"/>
</enrich>
<log level="custom" separator=",">
<property name="Service_Response" expression="get-property('Ouput_Respose_Service')"/>
</log>
<respond description=""/>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
<faultSequence>
<sequence key="{faultSEQ}"/>
</faultSequence>
</resource>
</api>