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"/>
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
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
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.
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>
Is it possible to enrich a specific node value with enrich mediator?
My goal is to enrich this xpath:
$ctx:OriginalPayload//Partner[identifiers/businessId = $ctx:CorrelationId]/identifiers/otherId
I have tried these examples:
$ctx:OriginalPayload//Partner/identifiers/otherId
//Partner/identifiers/otherId
//Partner/identifiers/otherId/text()
//Partner/identifiers/otherId/node()
All gave me this error:
ERROR - EnrichMediator Invalid Target object to be enrich.
I'm using this syntax:
<enrich>
<source xpath="//plat:CustomerAccountId"/>
<target xpath="//Partner/identifiers/otherId"/>
</enrich>
Below is my payload which i'm trying to enrich:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://iszkody.lsn.io/service/internal/ClaimService">
<soapenv:Header/>
<soapenv:Body>
<ns0:createClaimRequest>
<claim>
<InsClaimData VER="1">
<PartnerList>
<Partner>
<RoleList>
<Role>UBEZP</Role>
</RoleList>
<BusinessPartner>
<partnerType>person</partnerType>
<personData>
<firstName>JANUSZ</firstName>
<lastName>KOWALSKI</lastName>
<PESEL>83248328432</PESEL>
</personData>
<identifiers>
<businessId>123</businessId>
<otherId></otherId>
</identifiers>
</BusinessPartner>
</Partner>
</PartnerList>
</InsClaimData>
</claim>
</ns0:createClaimRequest>
</soapenv:Body>
</soapenv:Envelope>
It doesn't look like a problem with payload or xpath but more like the mediator doesn't implement custom type.
I just tested the following in WSO2 ESB 4.9.0 and also 4.8.1 and in both version the following proxy did work (I enrichted the otherId with the businessId):
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Test_XPath" transports="http" xmlns:avintis="http://www.avintis.com">
<target faultSequence="faultSequence">
<inSequence>
<sequence key="initSequence" />
<log level="full"></log>
<log level="custom">
<property expression="$body//businessId" name="xpath" />
</log>
<log level="custom">
<property expression="$body//Partner/BusinessPartner/identifiers/businessId" name="xpath" />
</log>
<enrich>
<source xpath="//businessId" />
<target xpath="//otherId" />
</enrich>
<log level="full" />
</inSequence>
</target>
</proxy>
As you commented that you now use the *[local-name()='BusinessPartner'] syntax, this points out to be an issue with the namespaces. Try to use the correct namespace of the BusinessParter elements.