SOAP

The OG integration other than email

Jace Benson

Table of content
  1. SOAPMessageV2
  2. Setting SOAP Headers
  3. Using WSDLs
  4. Key Differences from REST
  5. When to Use SOAP
  6. Additional Resources

Docs

SOAPMessageV2 is the legacy way to make outbound SOAP calls from ServiceNow. If you're integrating with an old system that only speaks SOAP, this is your path. If you have a choice, use REST instead.

SOAPMessageV2

var request = new sn_ws.SOAPMessageV2();
request.setEndpoint('https://api.example.com/soap/service');
request.setSOAPAction('MyMethod');
request.setRequestBody('<soap:Envelope>...</soap:Envelope>');

var response = request.execute();
var body = response.getBody();
var status = response.getStatusCode();

Setting SOAP Headers

request.setRequestHeader('SOAPAction', 'MyMethod');
request.setBasicAuth('username', 'password');

Using WSDLs

You can import WSDLs into ServiceNow (wsdl table) and generate SOAPMessage definitions. Once imported, reference them by name:

var request = new sn_ws.SOAPMessageV2('my_wsdl', 'my_operation');
var response = request.execute();

This is cleaner than building SOAP envelopes by hand, but honestly, it's still XML in 2025.

Key Differences from REST

When to Use SOAP

If you're starting greenfield, don't reach for SOAP. Use REST Outbound instead. If you need SOAP inbound, see Inbound SOAP.

Additional Resources