---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Create a new scripted SOAP web service

# Create a new scripted SOAP web service {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Follow these examples to create a new scripted SOAP web service.
When the Web Services Provider - Scripted plugin is activated, a new module
Scripted Web Services is available under the System Web Services application.  
Figure 1. Scripted SOAP web services

## Example 1: Retrieving a system property {#createSOAPwebservice__section_yn2_1y2_f3b}

The first step is to define the incoming and return parameters. This is done by adding an
entry to the Input Parameters and Output Parameters. These
parameters are used to construct and present a meaningful WSDL, and they do not add to the
functionality of processing the actual Web Service itself.  
Figure 2. GetProperty Input \& Output Parameters

The parameters are referenced in the script of the Web Service. Any of the input parameters are retrieved using the following syntax:

    var a= request.property;

The output parameters are set by using the following syntax:

    response.property="ABC";

The following example demonstrates how to retrieve a system property and return it as part
of the SOAP response. The example shows how to create a custom scripted web service to do
something specific that the base ServiceNow system direct Web Services
cannot.  
Figure 3. GetProperty web service

## Example 2: Ordering a Blackberry {#createSOAPwebservice__section_zn2_1y2_f3b}

[Direct web services](https://servicenow-prod.fluidtopics.net/IjCXCWB8T1b~VABg1p3Ehw "A direct web service is available for any table in the system if the correct access control list is configured.")
operate on tables and their data. The following example shows how to initiate a business
solution, such as ordering a Blackberry, by invoking a scripted web service. The following
input and output parameters support the Blackberry example:  
Figure 4. Input output Blackberry

This script shows how to use the above parameters to add a Blackberry to the service catalog shopping cart and order it. The request number is returned in the request_number field of the SOAP response.

    var cart = new Cart();
    var item = cart.addItem('e2132865c0a8016500108d9cee411699');
    cart.setVariable(item,'original', request.phone_number);
     
    // set the requested for
    var gr = new GlideRecord("sys_user");
    gr.addQuery("user_name", request.requested_for);
    gr.query();

    if(gr.next()){
      var cartGR = cart.getCart();
      cartGR.requested_for = gr.getUniqueValue();
      cartGR.update();
    }
     
    var rc = cart.placeOrder();
    response.request_number= rc.getValue('number');


