Creating an import set web service
Summarize
Summary of Creating an import set web service
This guide explains how ServiceNow customers can create an import set web service to stage and transform imported data efficiently. The process involves setting up a web service import set table, optionally creating a transform map, and customizing the web service response. This enables automated and structured data integration into ServiceNow tables through inbound web services.
Show less
Creating the Web Service Import Set
- Navigate to All > System Web Services > Inbound > Create New in ServiceNow.
- Specify the web service Name (used as the import set table name) and Label (displayed in the import sets table).
- Optionally check Create transform map and select the target table to define how data should be transformed after import.
- After creation, you are directed to the Transform Map form to further specify mappings or scripts.
Web Service Fields
- Fields defined for the web service are exposed in the WSDL with the specified Name and appear in the import set table with the chosen Label.
- All fields default to
xsd:stringtype. - You can add, modify, or delete fields before or after web service creation by editing the target table.
Mapping and Transforming Data
- Transform maps created during or after web service creation run synchronously by default when the service is invoked.
- This allows transforming staged import data into the target table format.
Customizing Web Service Response
- Transform map scripts can modify the web service response dynamically using a
responseJavaScript object. - For example, adding custom fields like
transactionidor messages to the SOAP response. - This customization helps provide meaningful feedback to the web service consumer about the import operation.
Debugging Inbound SOAP Requests
- To debug SOAP requests, create the system property
glide.processor.debug.SOAPProcessorand set it to true. - This logs all incoming SOAP requests to the System Log for troubleshooting.
- Remember to set the property back to false after debugging to manage log size.
Create a web service import set table to define how to stage and transform imported data.
Navigate to .
The Name of the web service is the table name of the import set table whereas the Label field is the resulting table field.
If you want to create a transform map after creating the web service, check the Create transform map checkbox and choose the target table you want the data to transform into. After the Create button is selected, the web service is created and you will be immediately put into the Table Transform Map form. You may then continue to specify the transform map or script.
Web Service Fields
The fields available for this web service. All fields by default are published as the
XSD type of xsd:string. The
Name is the field that is exposed for the web service and therefore appears as
the name of the field in the WSDL. The Label is the label of the field as it
appears for the import sets table.
To add other fields after the Web Service is created, find the target table, and add the fields to that table.
Mapping web service import sets
During the creation of the web service import set, you may optionally create the transform map for it.
All transform maps are executed for the service when it is invoked and the import set mode is set as "Synchronous" (the default).
Adding Web Service Response Values
| Variable name | Type | Description |
|---|---|---|
| response | Output Object | Javascript object that holds dynamically created response elements used to customize the output response of a web service import set insert. |
Example
// create new elements called "transaction_id"
// and "hello" in the web service response
response.transaction_id="abc123";
response.hello="world";
status_message="message 1";
// this is the normal status_message variable
<soapenv:Envelopexmlns:imp="http://www.service-now.com/imp_notification"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/><soapenv:Body>
<insertResponse xmlns="http://www.service-now.com/imp_notification">
<sys_id>969d157c0a0a0baf008ba5770ffa798c</sys_id>
<table>incident</table>
<display_name>number</display_name>
<display_value>INC0010091</display_value>
<status>inserted</status>
<status_message>message 1</status_message>
<transaction_id>abc123</transaction_id>
<hello>world</hello>
</insertResponse>
</soapenv:Body></soapenv:Envelope>Debugging web service import sets
To debug a SOAP Request coming into the system, create the system property glide.processor.debug.SOAPProcessor.
Once you have created it, set it to true to have all SOAP requests be logged in the System Log. Set it to false when you are done to keep the size of your System Log to a managed length.