Thursday, July 11, 2019

Send a Web Service request via HTTP Testing Tool

This is to show asample of sending a Web Services SOAP request to an HTTP Testing Tool such asFiddler and RESTClient:

Select"POST" as the HTTP method.

 

On the URL,indicate the endpoint. For example: https://webservices.na1.netsuite.com/services/NetSuitePort_2013_2

 

Add the followingheader:

 

SOAPAction:<type of operation> (e.g. SOAPAction: get)

Content-Type:application/xml

 

On the RequestBody, indicate the SOAP XML. See sample SOAP below for the 'get' operation.

 

 

<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

  <soapenv:Header>

     <platformMsgs:passport

         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

         xmlns:xsd="http://www.w3.org/2001/XMLSchema"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xmlns:platformCore="urn:core_2013_2.platform.webservices.netsuite.com"

         xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com">

        <platformCore:email>user@test.com</platformCore:email>

        <platformCore:password>**********</platformCore:password>

        <platformCore:account>123456</platformCore:account>

        <platformCore:role internalId="3" />

     </platformMsgs:passport>

     <platformMsgs:applicationInfo

       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

       xmlns:xsd="http://www.w3.org/2001/XMLSchema"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com"/>

     <platformMsgs:partnerInfo

       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

       xmlns:xsd="http://www.w3.org/2001/XMLSchema"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com"/>

     <platformMsgs:preferences

       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

       xmlns:xsd="http://www.w3.org/2001/XMLSchema"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com"/>

  </soapenv:Header>

  <soapenv:Body>

     <platformMsgs:get

         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

         xmlns:xsd="http://www.w3.org/2001/XMLSchema"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xmlns:s0="urn:core_2013_2.platform.webservices.netsuite.com"

         xmlns:platformMsgs="urn:messages_2013_2.platform.webservices.netsuite.com">

        <platformMsgs:baseRef xsi:type="s0:RecordRef"internalId="5" type="customer" />

     </platformMsgs:get>

  </soapenv:Body>

</soapenv:Envelope>

 

 

 

Upon executingthe request, the response can be obtained from the Response Body.

No comments:

Post a Comment