{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1253,"path":"api-reference/web-services/createSOAPwebservice.md","title":"Create a new scripted SOAP web service","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a new scripted SOAP web service\n\nFollow these examples to create a new scripted SOAP web service.\n\nWhen the Web Services Provider - Scripted plugin is activated, a new module Scripted Web Services is available under the System Web Services application.\n\n\\[Omitted image \"scripted-soap-web-services.png\"\\] Alt text: Scripted SOAP Web Services\n\n## Example 1: Retrieving a system property\n\nThe 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.\n\n\\[Omitted image \"soap-GetProperty-input-parameters.png\"\\] Alt text: GetProperty Input Parameters\n\n\\[Omitted image \"soap-GetProperty-output-parameters.png\"\\] Alt text: GetProperty Output Parameters\n\nThe parameters are referenced in the script of the Web Service. Any of the input parameters are retrieved using the following syntax:\n\n```\nvar a= request.property;\n```\n\nThe output parameters are set by using the following syntax:\n\n```\nresponse.property=\"ABC\";\n```\n\nThe 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.\n\n\\[Omitted image \"GetProperty-soap-web-service.png\"\\] Alt text: GetProperty web service\n\n## Example 2: Ordering a Blackberry\n\n[Direct web services](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/web-services/c_DirectWebServices.md) 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:\n\n\\[Omitted image \"soap-blackberry-input-parameters.png\"\\] Alt text: OrderBlackBerry Input Parameters\n\n\\[Omitted image \"soap-blackberry-output-parameters.png\"\\] Alt text: OrderBlackBerry Output Parameters\n\nThis 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.\n\n```\nvar cart = new Cart();\nvar item = cart.addItem('e2132865c0a8016500108d9cee411699');\ncart.setVariable(item,'original', request.phone_number);\n \n// set the requested for\nvar gr = new GlideRecord(\"sys_user\");\ngr.addQuery(\"user_name\", request.requested_for);\ngr.query();\n\nif(gr.next()){\n  var cartGR = cart.getCart();\n  cartGR.requested_for = gr.getUniqueValue();\n  cartGR.update();\n}\n \nvar rc = cart.placeOrder();\nresponse.request_number= rc.getValue('number');\n```\n\n**Parent Topic:**[Scripted SOAP web services](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/web-services/c_ScriptedWebServices.md)\n\n"}}