Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
How to make a SOAP Call to your instance using the CURL command - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • How to make a SOAP Call to your instance using the CURL command
KB0690780

How to make a SOAP Call to your instance using the CURL command


248260 Views Last updated : Sep 26, 2024 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

Learn the procedure to create a SOAP Call to an instance using the CURL command in order to troubleshoot possible issues when using the SOAP API.

Resolution

Soap Request Flow

In the SOAP Request Flow, the SOAP Sender creates SOAP Request Message for SOAP Receiver. SOAP Receiver sends SOAP Respond Message.

 

Step 1:
 
A. Create the SOAP Envelope that contains the request that has to be sent
Note: The soap request parameters depend on the parameters that the WSDL exposes.
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident">
 <soapenv:Header/>
 <soapenv:Body>
    <inc:get>
       <sys_id><enter_sys_ID_of_record_to_retrieve</sys_id>
       </inc:get>
 </soapenv:Body>
</soapenv:Envelope>
B.  Save it as an XML file (example test.xml)
 
Step 2:

Create the CURL command that you will input in the terminal.

curl --username:password --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction: ACTION_YOU_WANT_TO_CALL" --data @FILE_NAME URL_OF_THE_SOAP_WEB_SERVICE_ENDPOINT

Example 1: If you are consuming the WSDL from an Instance

curl --user xyz:abc123 --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:Get" --data @test.xml https://<instance_name>.service-now.com/incident.do?SOAP 

Example 2: If you are consuming the WSDL from a Node

curl --user xyz:abc123 --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:Get" --data @test.xml https://<noce_name>.service-now.com:<Port_Number>/incident.do?SOAP 

Step 3: 

Execute the command in Terminal or command prompt.

Troubleshooting:

If ever you see that you are not receiving the expected output, then add the verbose parameter to the curl command and this shall give you more information.

Example of the curl command with verbose:

curl --user xyz:abc123 --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:Get" --data @test.xml https://<instance_name>.service-now.com/incident.do?SOAP -v 
 

Common issues:

1.The file containing the request is not readable

Error:                

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Unable to parse SOAP document</faultstring>
<detail>Error completing SOAP request</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Solution: Check the content and format of the file that contains the SOAP Request 

2. The credential of the specified user is wrong or user is not authorized to access the WSDL

Error:

...
...
< HTTP/1.1 401 Unauthorized
< Set-Cookie: JSESSIONID=5C48D05E518DC37DA6502440F2FD8361; Path=/; HttpOnly;Secure
* Authentication problem. Ignoring this.
...
...

Solution: Check the user credential and if there is any ACL blocking the user from accessing the record

3. The WSDL is incorrect/wrong

Error:

* Could not resolve host: <URL_OF_THE_SOAP_WEB_SERVICE_ENDPOINT>
* Closing connection 0
curl: (6) Could not resolve host: URL_OF_THE_SOAP_WEB_SERVICE_ENDPOINT

Solution: Check if the correct URL is specified in the curl command.

Related Links

  • SOAP Messages
  • SOAP Roles
  • SOAP Message Function
  • SOAP Default Security Policy

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.