Payload factory is unable to handle special characters in XML payloads

<payloadFactory media-type="xml">
<format>
<p:_postinsertmembersearch xmlns:p="http://ws.wso2.org/dataservice">
<superfundAddress>$1</superfundAddress>
<p:_postinsertmembersearch>
</format>
<args>
<arg evaluator="json" expression="$.superfundAddress"/>
</args>
</payloadFactory>
{
"superfundAddress" : "123&456 Test 5 Street"
}
TID: [-1234] [] [2020–11–05 19:42:12,154] ERROR {org.apache.synapse.mediators.base.SequenceMediator} - [com.ctc.wstx.exc.WstxLazyException] Unexpected character '4' (code 52) (expected a name start character)
at [row,col {unknown-source}]: [1,808] {org.apache.synapse.mediators.base.SequenceMediator}
[com.ctc.wstx.exc.WstxLazyException] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '4' (code 52) (expected a name start character)
at [row,col {unknown-source}]: [1,808]
at com.ctc.wstx.exc.WstxLazyException.throwLazily(WstxLazyException.java:45)
at com.ctc.wstx.sr.StreamScanner.throwLazyError(StreamScanner.java:720)
  1. With XML evaluator
<payloadFactory media-type="xml">
<format>
<p:_postinsertmembersearch xmlns:p="http://ws.wso2.org/dataservice">
<p:super_fund_address>$1</p:super_fund_address>
<p:_postinsertmembersearch>
</format>
<args>
<arg evaluator="xml" expression="$body/superfundAddress"/>
</args>
</payloadFactory>
<property name="superfundAddress" expression="json-eval($.superfundAddress)"/>
<payloadFactory media-type="xml">
<format>
<p:_postinsertmembersearch xmlns:p="http://ws.wso2.org/dataservice">
<p:super_fund_address>$1</p:super_fund_address>
<p:_postinsertmembersearch>
</format>
<args>
<arg evaluator="xml" expression="$ctx:superfundAddress"/>
</args>
</payloadFactory>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store