Recent

Author Topic: Web Service Toolkit SOAP request body tuning  (Read 1870 times)

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Web Service Toolkit SOAP request body tuning
« on: February 14, 2018, 03:21:30 pm »
Hi all!
Can anyone advise me about the requests in the SOAP client? I'm using WST. While executing requests, I get an error from the SOAP service.
Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  3.    <S:Body>
  4.       <ns2:getAgentsResponse xmlns:ns2="http://ws.server.example.com/">
  5.          <return>
  6.             <messages>
  7.                <message>
  8.                   <message>Missing 'context' element</message>
  9.                   <type>ERROR</type>
  10.                </message>
  11.             </messages>
  12.          </return>
  13.       </ns2:getAgentsResponse>
  14.    </S:Body>
  15. </S:Envelope>

But this element exists in the request!
My SOAP request body (via WST) below:
Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  3.   <SOAP-ENV:Body xmlns:ns1="http://ws.server.example.com/">
  4.     <ns1:getAgents>
  5.       <ns1:context>
  6.         <ns1:locale>ru</ns1:locale>
  7.         <ns1:loginName>user</ns1:loginName>
  8.         <ns1:password>pass</ns1:password>
  9.         <ns1:salesPointCode>WEB_SITE</ns1:salesPointCode>
  10.       </ns1:context>
  11.     </ns1:getAgents>
  12.   </SOAP-ENV:Body>
  13. </SOAP-ENV:Envelope>
If it look at the request examples in the documentation for this SOAP service, it turns out that the main difference is that the nested XML elements in them are not marked by the ns1 namespace, but only the root one!
Example SOAP request body from service document:
Code: XML  [Select][+][-]
  1. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.server.example.com/">
  2.   <SOAP-ENV:Body>
  3. <ns1:getAgents>
  4.   <context>
  5.     <locale>ru</locale>
  6.     <loginName>user</loginName>
  7.     <password>pass</password>
  8.     <salesPointCode>WEB_SITE</salesPointCode>
  9.   </context>
  10. </ns1:getAgents>
  11.   </SOAP-ENV:Body>
  12. </SOAP-ENV:Envelope>
Most likely the question is layman, but still: is it possible to somehow customize the SOAP request generation of WST, so that it corresponds to the example from the documentation for the service?

 

TinyPortal © 2005-2018