Hi to all, im new try apigee, i have a soap service and create Proxy SOAP service. When i consumme this service by PostMan with payload in format XML this is correct but when try with json payload is wrong.
XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webservicex.net/"> <soapenv:Header/> <soapenv:Body> <web:GetGeoIP> <!--Optional:--> <web:IPAddress>170.133.212.223</web:IPAddress> </web:GetGeoIP> </soapenv:Body> </soapenv:Envelope>
JSON
{ "soapenv:Envelope": { "xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:web": "http://www.webservicex.net/", "soapenv:Body": { "web:GetGeoIP": { "web:IPAddress": "170.133.212.223" } } } }
Solved! Go to Solution.
It's hard to give a more informed opinion without looking at the generated proxy. But if you used the default Proxy SOAP Service generator, it will most likely expect a JSON request such as this:
{ "GetGeoIP": { "IPAddress": "170.133.212.223" } }
or perhaps, just
{ "IPAddress": "170.133.212.223" }
Try with any of these variations, and, if it still doesn't work, please attach the proxy as a zip file (You can obtain it by selecting Project -> Download Revision)
It's hard to give a more informed opinion without looking at the generated proxy. But if you used the default Proxy SOAP Service generator, it will most likely expect a JSON request such as this:
{ "GetGeoIP": { "IPAddress": "170.133.212.223" } }
or perhaps, just
{ "IPAddress": "170.133.212.223" }
Try with any of these variations, and, if it still doesn't work, please attach the proxy as a zip file (You can obtain it by selecting Project -> Download Revision)
Thanks deboraelkin
For this example is correct your solution.
but now i have other problem. When the xml has this structure.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://schema.poc.api"> <soapenv:Header/> <soapenv:Body> <sch:pocApiSync> <MessageHeader> <CreationDate>2018-01-11</CreationDate> </MessageHeader> <PocServiceRequest> <PocOrig> <ids>Prueba</ids> <name>api</name> <id>0</id> </PocOrig> <Detail> <idP>2</idP> <opId>TMX32948327489</opId> <amount Code="MXN">20.0</amount> <number>12345</number> <type>01</type> <date>2018-01-11</date> </Detail> <Control> <DateTime>2018-01-11T23:59:59.1234Z</DateTime> </Control> </PocServiceRequest> </sch:pocApiSync> </soapenv:Body> </soapenv:Envelope>
Similar to before, try with
{ "pocApiSync": { "MessageHeader": { "CreationDate": "2018-01-11" }, "PocServiceRequest": { "PocOrig": { "ids": "Prueba", "name": "api", "id": "0" }, "Detail": { "idP": "2", "opId": "TMX32948327489", "amount": { "-Code": "MXN", "#text": "20.0" }, "number": "12345", "type": "01", "date": "2018-01-11" }, "Control": { "DateTime": "2018-01-11T23:59:59.1234Z" } } } }
or directly with
{ "MessageHeader": { "CreationDate": "2018-01-11" }, "PocServiceRequest": { "PocOrig": { "ids": "Prueba", "name": "api", "id": "0" }, "Detail": { "idP": "2", "opId": "TMX32948327489", "amount": { "-Code": "MXN", "#text": "20.0" }, "number": "12345", "type": "01", "date": "2018-01-11" }, "Control": { "DateTime": "2018-01-11T23:59:59.1234Z" } } }
Thanks deboraelkin
I modified the XSLT and now i have this problem.
When my xml have a attribute.
<amount Code="MXN">20.0</amount>
i try with this json but is wrong
"amount": { "Code": "MXN", "value": "20.0" }
are you not using something like this:
"amount": { "-Code": "MXN", "#text": "20.0" },
...as shown in the answer above?
if not, why not?
If you prefer to use this:
"amount": { "Code": "MXN", "value": "20.0" }
...then you need to modify the XSLT to handle that differently.
Do you know XSLT?
Hi Dino
When try those my paylod is generte:
<amount> <_Code>MNX</_Code> <_text>20</_text> </amount>
and i want
<amount Code ="MNX"> 20</amount>
Thanks.
ok, can you give me the FULL input payload, and the FULL expected output payload, instead of just a snip?
User | Count |
---|---|
7 | |
2 | |
2 | |
2 | |
1 |