Hi all someone can support me to understand how to generate a proper Soap message when i have in input a json?
Actually i have added the policy Json to XML on my request flow and i am able to transform from json to soap but the soap message is very simple without name space and other info so i i am getting error invoking the back end.
Actually i have :
<soap> <userName>DIR/cosimo@mail.com</userName> <oldPassword>Password.1</oldPassword> <newPassword>Password.2</newPassword> </soap>
I need instead something like this :
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd"> <soap:Header/> <soap:Body> <xsd:changePasswordByUser> <!--Optional:--> <xsd:oldPassword>Password.1</xsd:oldPassword> <!--Optional:--> <xsd:newPassword>Password.2</xsd:newPassword> </xsd:changePasswordByUser> </soap:Body> </soap:Envelope>
I am trying to change the configuration of policy "Json to XML" and "XML to JSON" but actually not able to have success.
Please let me know.
Thank you
Cosimo
You cannot achieve it in one policy. You need a couple of policies to get this done. You can do it with jsonToXML+ some other policies as well. But I would take a little different path. See below:
1st step: Use an extract Variables policy and apply JsonPath to extract the few variables.
Use JsonPath to extract the two passwords and create the variables extracted.oldpassword and extracted.newpassword.
2nd step: Use an AssignMessage policy to construct the SOAP payload. In the AssignMessage policy you will use your extracted variables. So your AssignMessage may look something like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="a_name"> <Set> <Payload contentType="text/xml"> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd"> <soap:Header/> <soap:Body> <xsd:changePasswordByUser> <xsd:oldPassword>{extracted.oldpassword}</xsd:oldPassword> <xsd:newPassword>{extracted.newpassword}</xsd:newPassword> </xsd:changePasswordByUser> </soap:Body> </soap:Envelope> </Payload> </Set> </AssignMessage>
Hi sarthak , i have created a new API PRoxy by importing the wsdl file related to my web service. I see that now i have both the policy but during the test i have an errore. I attach here the zip file with trace log and my api proxy downloads.zipcould u let me know what i wrong?
Thanks
Cosimo
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |