I need to transform a message using WSO2 ESB and send it exactly as it has been formatted. I am receiving payload in xml format and I need to transform it into xml with soap envelope. For this I am using payload factory to transform the payload:
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:param="urn:www.my_url.com/param:1.6" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<param:GetUser>
<GetNameQue>
<firstname>$1</firstname>
<surname>$2</surname>
</GetNameQue>
</param:GetUser>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="//MessageGetUser/FirstName"/>
<arg evaluator="xml" expression="//MessageGetUser/Surname"/>
</args>
</payloadFactory>
Then I'm calling the other platform using:
<property name="messageType" scope="axis2" type="STRING" value="application/xml"/>
<call>
<endpoint>
<http method="post" uri-template="{uri.var.httpendpointurl}">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
I have been receiving an error for a bad formatting and after some debugging I found that my $body/ is sent and it looks like that:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<param:GetUser xmlns:param="urn:www.my_url.com/param:1.6">
<GetNameQue xmlns="http://ws.apache.org/ns/synapse">
<firstname>MyFirst</firstname>
<surname>MySecond</surname>
</GetNameQue>
</param:GetUser>
</soapenv:Body>
While my $env looks exactly what it need to be send:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:param="urn:www.my_url.com/param:1.6">
<soapenv:Body>
<param:GetUser>
<GetNameQue xmlns="http://ws.apache.org/ns/synapse">
<firstname>MyFirst</firstname>
<surname>MySecond</surname>
</GetNameQue>
</param:GetUser>
</soapenv:Body>
</soapenv:Envelope>
My question is there a way to send the envelope instead of the body or what exactly is send using a the call? For example I know that the current json ($) is the one being send when sending a json payload.
I'm sorry if my question sounds bad I just didn't find any information that helped me up to this point. Edit: I tried following solutions but they didn't work: WSO2 ESB Payload Factory creates invalid SOAP envelope https://isuruuy.medium.com/how-to-construct-a-payload-with-the-soap-envelope-ce8df5032dda https://medium.com/wso2-learning/wso2-esb-ei-apim-create-payloads-with-soap-envelope-481bc0dbf330
If you need any additional information please let me know and I will be glad to provide it.
Thank you all in advance!