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
Related
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
I'm trying to use enrichment mediator to populate custom response from End point
my sequence
<sequence name="GetMySqlData" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<enrich description="AddProductData">
<source clone="true" type="inline">
<ProductDataMySqlDB xmlns="">
<code/>
<name/>
<description/>
<qty/>
</ProductDataMySqlDB>
</source>
<target action="child" xpath="//mediate"/>
</enrich>
<property expression="$ctx:ProductCode" name="code" scope="default" type="STRING"/>
<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:getInventoryByCode>
<dat:code>$1</dat:code>
</dat:getInventoryByCode>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('code')"/>
</args>
</payloadFactory>
<property name="HTTP_METHOD" scope="axis2" type="STRING" value="POST"/>
<property name="SOAPAction" scope="transport" type="STRING" value="getInventoryByCode"/>
<call>
<endpoint key="getInventoryByCode"/>
</call>
--PROBLEMS STARTS ---
<enrich description="code">
<source clone="true" xpath="//Entry/code"/>
<target xpath="//mediate/ProductDataMySqlDB/code"/>
</enrich>
<enrich description="name">
<source clone="true" xpath="//Body/Entries/Entry/name"/>
<target xpath="//mediate/ProductDataMySqlDB/name"/>
</enrich>
<enrich description="description">
<source clone="true" xpath="//Entries/Entry/description" />
<target xpath="//mediate/ProductDataMySqlDB/description"/>
</enrich>
<enrich description="qty">
<source clone="true" xpath="//m0:Entries/m0:Entry/m0:qty" xmlns:m0="http://ws.wso2.org/dataservice" />
<target xpath="//mediate/ProductDataMySqlDB/qty"/>
</enrich>
<log level="full">
<property expression="$body" name="MySQLResponse"/>
</log>
<loopback/>
</sequence>
response that I getting form endpoint is like
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Entries xmlns="http://ws.wso2.org/dataservice">
<Entry>
<code>PR2</code>
<name>Product2</name>
<description>Product stored in MySQL</description>
<qty>-2</qty>
</Entry>
</Entries>
</soapenv:Body>
</soapenv:Envelope>
and the error in log are :
Specified node by xpath cannot be found. {org.apache.synapse.mediators.elementary.EnrichMediator}
Cannot Enrich message from an empty source. {org.apache.synapse.mediators.elementary.EnrichMediator}
so it looks like the xpath for my source is wrong
<enrich description="code">
<source clone="true" xpath="WHAT WOULD BE THE CORRECT PATH?"/>
<target xpath="//mediate/ProductDataMySqlDB/code"/>
</enrich>
thnks
In your message, 'Entry' and 'code' nodes belongs to a namespace "http://ws.wso2.org/dataservice" (look at the 'Entries' root node) : you should declare and use this namespace in your source xpath :
<source xmlns:ds="http://ws.wso2.org/dataservice" clone="true" xpath="//ds:Entry/ds:code"/>
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>
Sometimes when I am using Callout mediator I am receiving this message specially if I have made previous calls/callouts before in the sequence.
This is the message I receive: ERROR_CODE = 0, ERROR_MESSAGE = Error while performing the callout operation.
This specially occurs when using chaining within proxies.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="InsChildCustomer"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full" separator=", ***********Incoming###########"/>
<property name="originalMessage"
expression="$body"
scope="default"
type="OM"/>
<property xmlns:cus="http://www.example.org/customerWSO2/"
name="SNIPPMessage"
expression="$body/cus:insertChildCustToNSRequest"
scope="default"
type="OM"/>
<sequence key="conf:/resources/sequences/InsChildCustomerHeaderSeq.xml"/>
<filter xmlns:cus="http://www.example.org/customerWSO2/"
source="boolean(//cus:insertChildCustToNSRequest/cus:childCustData/cus:customerContacts/cus:customerContact[1]/cus:email)"
regex="true">
<then>
<property name="customerContacts"
expression="//cus:insertChildCustToNSRequest/cus:childCustData/cus:customerContacts"
scope="default"
type="OM"/>
</then>
<else>
<property name="noContacts" value="1" scope="default" type="INTEGER"/>
</else>
</filter>
<header name="Action" scope="default" value="addList"/>
<payloadFactory media-type="xml">
<format>
<addressbook xmlns=""
xmlns:platformCommon="urn:common_2015_1.platform.webservices.NS.com"
xmlns:listRel="urn:relationships_2015_1.lists.webservices.NS.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:platformCore="urn:core_2015_1.platform.webservices.NS.com"
xsi:type="listRel:CustomerAddressbook">
<defaultBilling>$1</defaultBilling>
<defaultShipping>$2</defaultShipping>
<addressbookAddress xsi:type="platformCommon:Address">
<addr1>$3</addr1>
<addr2>$4</addr2>
<addr3>$5</addr3>
<customFieldList>
<customField scriptId="custrecord_addr_4"
xsi:type="platformCore:StringCustomFieldRef">
<value>$6</value>
</customField>
</customFieldList>
<city>$7</city>
<state>$8</state>
<zip>$9</zip>
<country>$10</country>
</addressbookAddress>
</addressbook>
</format>
<args>
<arg evaluator="xml" expression="//cus:billingaddressindicator/text()"/>
<arg evaluator="xml" expression="//cus:shippingaddressindicator/text()"/>
<arg evaluator="xml" expression="//cus:addr1/text()"/>
<arg evaluator="xml" expression="//cus:addr2/text()"/>
<arg evaluator="xml" expression="//cus:addr3/text()"/>
<arg evaluator="xml" expression="//cus:custrecord_addr_4/text()"/>
<arg evaluator="xml" expression="//cus:city/text()"/>
<arg evaluator="xml" expression="//cus:state/text()"/>
<arg evaluator="xml" expression="//cus:zip/text()"/>
<arg evaluator="xml" expression="//cus:country/text()"/>
</args>
</payloadFactory>
<send>
<endpoint key="conf:/resources/endpoints/NSEndpoint.xml"/>
</send>
</inSequence>
<outSequence>
<header xmlns:platformMsgs="urn:messages_2015_1.platform.webservices.NS.com"
name="platformMsgs:documentInfo"
scope="default"
action="remove"/>
<property xmlns:platformMsgs="urn:messages_2015_1.platform.webservices.NS.com"
xmlns:platformCore="urn:core_2015_1.platform.webservices.NS.com"
name="isSuccess"
expression="//addListResponse/platformMsgs:writeResponseList/platformMsgs:writeResponse/platformCore:status/#isSuccess"
scope="default"
type="STRING"/>
<filter xmlns:platformMsgs="urn:messages_2015_1.platform.webservices.NS.com"
xmlns:platformCore="urn:core_2015_1.platform.webservices.NS.com"
source="//addListResponse/platformMsgs:writeResponseList/platformMsgs:writeResponse/platformCore:status/#isSuccess"
regex="true">
<then>
<log level="full" separator=", *******before_iterator********"/>
<property name="customerInternalId"
expression="//addListResponse/platformMsgs:writeResponseList/platformMsgs:writeResponse/platformMsgs:baseRef/#internalId"
scope="default"
type="STRING"/>
<header name="platformMsgs:platformMsgs:documentInfo"
scope="default"
action="remove"/>
<property name="type"
expression="//addListResponse/platformMsgs:writeResponseList/platformMsgs:writeResponse/platformMsgs:baseRef/#type"
scope="default"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<urn:get xmlns:urn="urn:messages_2015_1.platform.webservices.NS.com"
xmlns:urn1="urn:core_2015_1.platform.webservices.NS.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<urn:baseRef internalId="$1" type="customer" xsi:type="urn1:RecordRef">
<urn1:name/>
</urn:baseRef>
</urn:get>
</format>
<args>
<arg evaluator="xml" expression="get-property('customerInternalId')"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="get"/>
<sequence key="conf:resources/sequences/customerAddPassport.xml"/>
<sequence key="conf:resources/sequences/customerAddPreferences.xml"/>
<callout endpointKey="conf:/resources/endpoints/NSEndpoint.xml">
<endpoint name="NSEndpoint">
<address uri="https://webservices.sandbox.NS.com/services/NSPort_2015_1"/>
</endpoint>
<source type="envelope"/>
<target xpath="$body/*"/>
</callout>
<property xmlns:ns="urn:messages_2015_1.platform.webservices.NS.com"
xmlns:listRel="urn:relationships_2015_1.lists.webservices.NS.com"
name="customerEntityId"
expression="//ns:getResponse/ns:readResponse/ns:record/listRel:entityId"
scope="default"
type="STRING"/>
<log level="full" separator=", After_Get"/>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<payloadFactory media-type="xml">
<format>
<cus:insertChildCustToNSRequest xmlns:cus="http://www.example.org/customerWSO2/">$1
<cus:transactionid>$2</cus:transactionid>
<InternalID xmlns="">$3</InternalID>
</cus:insertChildCustToNSRequest>
</format>
<args>
<arg xmlns:cus="http://www.example.org/customerWSO2/"
evaluator="xml"
expression="$ctx:SNIPPMessage//cus:childCustData"/>
<arg xmlns:cus="http://www.example.org/customerWSO2/"
evaluator="xml"
expression="$ctx:SNIPPMessage//cus:transactionid"/>
<arg evaluator="xml" expression="get-property('customerInternalId')"/>
</args>
</payloadFactory>
<header xmlns:urn="urn:messages_2015_1.platform.webservices.NS.com"
name="urn:passport"
scope="default"
action="remove"/>
<header xmlns:urn="urn:messages_2015_1.platform.webservices.NS.com"
name="urn:preferences"
scope="default"
action="remove"/>
<log level="full" separator=", before SNIPP CALL"/>
<call>
<endpoint key="conf:/resources/endpoints/Teacher.QEndpoint.xml"/>
</call>
<property name="OUT_ONLY" value="false" scope="default" type="STRING"/>
<property name="DISABLE_CHUNKING"
value="false"
scope="axis2"
type="STRING"/>
<property name="messageType" value="text/xml" scope="axis2" type="STRING"/>
<property name="ContentType" value="text/xml" scope="axis2" type="STRING"/>
<filter source="get-property('noContacts')" regex="1">
<then>
<log level="full" separator=", *******without_contacts********"/>
<enrich>
<source type="inline" clone="true">
<insertChildCustToNSResponse xmlns="">
<Type/>
<Status/>
<CustomerInternalId/>
<CustomerEntityId/>
<ContactInternalId>N.A.</ContactInternalId>
</insertChildCustToNSResponse>
</source>
<target type="body"/>
</enrich>
<enrich>
<source type="property" clone="true" property="type"/>
<target xpath="//insertChildCustToNSResponse/Type"/>
</enrich>
<enrich>
<source type="property" clone="true" property="isSuccess"/>
<target xpath="//insertChildCustToNSResponse/Status"/>
</enrich>
<enrich>
<source type="property" clone="true" property="customerInternalId"/>
<target xpath="//insertChildCustToNSResponse/CustomerInternalId"/>
</enrich>
<enrich>
<source type="property" clone="true" property="customerEntityId"/>
<target xpath="//insertChildCustToNSResponse/CustomerEntityId"/>
</enrich>
</then>
<else>
<log level="full" separator=", *******with_contacts********"/>
<drop/>
</else>
</filter>
</then>
<else>
<log level="full" separator=", From false###########"/>
<property name="errorCode"
expression="//addListResponse/platformMsgs:writeResponseList/platformMsgs:writeResponse/platformCore:status/platformCore:statusDetail/platformCore:code"
scope="default"
type="STRING"/>
<property name="errorMessage"
expression="//addListResponse/platformMsgs:writeResponseList/platformMsgs:writeResponse/platformCore:status/platformCore:statusDetail/platformCore:message"
scope="default"
type="STRING"/>
<enrich>
<source type="inline" clone="true">
<insertChildCustToNSResponse xmlns="">
<Status/>
<ErrorCode/>
<ErrorMessage/>
</insertChildCustToNSResponse>
</source>
<target type="body"/>
</enrich>
<enrich>
<source type="property" clone="true" property="isSuccess"/>
<target xpath="//insertChildCustToNSResponse/Status"/>
</enrich>
<enrich>
<source type="property" clone="true" property="errorCode"/>
<target xpath="//insertChildCustToNSResponse/ErrorCode"/>
</enrich>
<enrich>
<source type="property" clone="true" property="errorMessage"/>
<target xpath="//insertChildCustToNSResponse/ErrorMessage"/>
</enrich>
</else>
</filter>
<send/>
</outSequence>
</target>
<publishWSDL key="conf:/resources/wsdls/Customer.wsdl"/>
<parameter name="serviceType">proxy</parameter>
<description/>
</proxy>
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ChildCustomerToSnipp"
transports="jms"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="customerInternalId"
expression="//InternalID"/>
<log level="full" separator="**Consumed from IN MQ before Seq**"/>
<sequence key="ConvertCustomerSoapToJSONSeq"/>
</inSequence>
<outSequence>
<log level="full" separator="**Consumed from OUT Seq**"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="snippMemberId"
expression="json-eval($.Data)"/>
<log level="custom" separator="**From Out Seq before Update**">
<property xmlns:ns="http://org.apache.synapse/xsd"
name="DataProperty"
expression="get-property('snippMemberId')"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="customerInternalId"
expression="get-property('customerInternalId')"/>
</log>
<sequence key="UpdateSnippMemeber"/>
</outSequence>
</target>
<parameter name="transport.jms.ContentType">text/xml</parameter>
<parameter name="transport.jms.Destination">Teacher.Q</parameter>
<description/>
</proxy>
I am really worrying about this future.If your developing some product like middleware you should aware of all the future like transaction,sec,.etc
security is good in wso2 where as transactions are really poor
i am using wso2esb4.8.0 and wso2dss3.0.1 .I wish to insert the data into my 2 tables simple logic if my 2nd table went wrong my first table also roll backed.For this i used wso2dss Box-carring future and its perfectly fine while i am doing from wso2dss try-it .BUt same future i wish to incorporate with wso2esb .i call 4 operation like beginboxcarring,insertintot1,insertintot2,endboxcarring but its not working in this then i got sloution with get JSESSIONID which will create when call a beginboxcarring but there is no use i tried with this properties to get JSESSIONID
and my proxy is
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TransactionProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="M1" value="*************HITTING Transaction PROXY*************"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="companycode" expression="//companycode/text()"/>
<property name="companyname" expression="//companyname/text()"/>
<property name="clientcode" expression="//clientcode/text()"/>
<property name="clientname" expression="//clientname/text()"/>
<property name="session type"
value="JSESSIONID"
scope="default"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dat="http://ws.wso2.org/dataservice">
<soapenv:Header/>
<soapenv:Body/>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="full">
<property name="M2" value="*************HITTING Transaction PROXY*************"/>
</log>
<header name="Action" value="urn:begin_boxcar"/>
<property name="setCookieHeader"
expression="$trp:Set-Cookie"
scope="default"
type="STRING"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/begin_boxcar"
action="urn:begin_boxcar">
<source type="envelope"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<property name="setCookieHeader"
expression="$trp:Set-Cookie"
scope="default"
type="STRING"/>
<log level="full">
<property name="JSESSIONID" expression="get-property('setCookieHeader')"/>
</log>
<payloadFactory media-type="xml">
<format>
<p:insertinto_mclient_OP xmlns:p="http://ws.wso2.org/dataservice">
<xs:clientcode xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:clientcode>
<xs:clientname xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:clientname>
<xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:createdbyid>
<xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:modifiedbyid>
</p:insertinto_mclient_OP>
</format>
<args>
<arg evaluator="xml" expression="get-property('clientcode')"/>
<arg evaluator="xml" expression="get-property('clientname')"/>
</args>
</payloadFactory>
<header name="Action" value="urn:insertinto_mclient_OP"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/"
action="urn:insertinto_mclient_OP">
<source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<payloadFactory media-type="xml">
<format>
<p:insertinto_mcompany_OP xmlns:p="http://ws.wso2.org/dataservice">
<xs:companycode xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:companycode>
<xs:comapnyname xmlns:xs="http://ws.wso2.org/dataservice">$2</xs:comapnyname>
<xs:createdbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:createdbyid>
<xs:modifiedbyid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:modifiedbyid>
<xs:clientid xmlns:xs="http://ws.wso2.org/dataservice">-1</xs:clientid>
</p:insertinto_mcompany_OP>
</format>
<args>
<arg evaluator="xml" expression="get-property('companycode')"/>
<arg evaluator="xml" expression="get-property('companyname')"/>
</args>
</payloadFactory>
<log level="full">
<property name="M5" value="**************hitting2nd dss*****"/>
</log>
<header name="Action" value="urn:insertinto_mcompany_OP"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/"
action="urn:insertinto_mcompany_OP">
<source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dat="http://ws.wso2.org/dataservice">
<soapenv:Header/>
<soapenv:Body/>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<log level="full">
<property name="M3" value="*************HITTING Transaction PROXY*************"/>
</log>
<header name="Action" value="urn:end_boxcar"/>
<callout serviceURL="http://localhosttt:9764/services/Transaction/end_boxcar"
action="urn:end_boxcar">
<source type="envelope"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<log level="full">
<property name="M4" value="*************HITTING Transaction PROXY*************"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
but log is showing JSESSIONID=null
and even i tried this properties also no change in log
<property name="setCookieHeader"
expression="get-property('transport','Set-Cookie')"
scope="default"
type="STRING"/>
<property name="setCookieHeader5"
expression="get-property('transport','JSESSIONID')"
scope="default"
type="STRING"/>
how would i get if i call from CURL the dss operation begin_boxcarring end point giving like this in header
Set-Cookie: JSESSIONID=6776AC50E31EBFC456CDA1895ACDE0B8; Path=/; HttpOnly
but unable to get into synapse how would i get .is there any option for transaction really worried about this future in wso2