Reputation: 453
I have the below proxy service which is being called by a proxy service.
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="seq_invchk_slpa_in" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property name="STATUS::" value="***************************"/>
</log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:hnb="http://10.104.74.93/hnb"
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">
<soapenv:Header/>
<soapenv:Body>
<hnb:CheckInvoiceDetails soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<invoice_no xsi:type="xsd:string">$1</invoice_no>
</hnb:CheckInvoiceDetails>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="$ctx:invoice_no"/>
</args>
</payloadFactory>
<property name="ContentType" scope="axis2" type="STRING" value="text/xml"/>
<header name="Action" scope="default" value="CheckInvoiceDetails"/>
<property name="SOAPAction" scope="transport" type="STRING" value="CheckInvoiceDetails"/>
<send>
<endpoint key="gov:INVCHK/SLPA/endpoints/invchk_slpa_validation_ep.xml"/>
</send>
</sequence>
When calling from a tool (SOAP UI) the service works without any problem.
But when calling from a system an issue arises. what I have traced out so far is during the correct call the payload factory message is sent as
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hnb="http://10.104.74.93/hnb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<hnb:CheckInvoiceDetails soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<invoice_no xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">17231374967185</invoice_no>
</hnb:CheckInvoiceDetails>
</soapenv:Body>
</soapenv:Envelope>
When the erroneous call is made the payload message goes out of the ESB as
<?xml version="1.0" encoding="UTF-8"?>
<hnb:CheckInvoiceDetails xmlns:hnb="http://10.104.74.93/hnb" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<invoice_no xmlns="http://ws.apache.org/ns/synapse" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">17231374967185</invoice_no>
</hnb:CheckInvoiceDetails>
which I think causes the issue. The response i get from the client during the erroneous call is
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring>
<detail xsi:type="xsd:string" />
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How can I preserve the SOAP message as it is and send it out when being called by a system.
Why are the soap namespaces getting mixed up in the
method level
<hnb:CheckInvoiceDetails xmlns:hnb="http://10.104.74.93/hnb" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
Any help will be very much appreciated.
Upvotes: 0
Views: 695
Reputation: 1822
You at least have to change content of Payload Factory mediator to
<payloadFactory media-type="xml">
<format>
<hnb:CheckInvoiceDetails xmlns:hnb="http://10.104.74.93/hnb">
<hnb:invoice_no xsi:type="xsd:string">$1</hnb:invoice_no>
</hnb:CheckInvoiceDetails>
</format>
<args>
<arg evaluator="xml" expression="$ctx:invoice_no"/>
</args>
</payloadFactory>
pay attention to invoice_no tag. Originally it is not clear what a namespace it suppose to have, it actually nest namespace of synapse engine, by default. So better to assign namespace explicitly.
Synapse engine will add envelope by default.
If a message type is unknown this returns soap12. found in documentation of Synapse. Property Content-Type without messageType is useless.
Upvotes: 1