---
title: Customize response
description: Follow this example to customize and control the XML payload of a SOAP response.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/web-services/t\_CustomizeResponse.html
release: australia
product: Web Services
classification: web-services
topic_type: task
last_updated: "2026-03-12"
reading_time_minutes: 1
breadcrumb: [Scripted Services, SOAP web service, Inbound, Web services, API implementation, API implementation and reference]
---
# Customize response
Follow this example to customize and control the XML payload of a SOAP response.
## Before you begin
Role required: web\_service\_admin or admin
## Procedure
1. Create a customized XML document using the [XMLDocument](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/c_XMLDocumentScriptObject.md) script include object.
**Note:** When creating a scripted web service in a scoped application you must use the [XMLDocument2](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_XMLDocument2ScopedAPI.md) API.
2. Set its document element to the variable *response.soapResponseElement* in a scripted web service.
For example, the following scripted web service script:
```
var xmldoc = new XMLDocument2();
xmldoc.parseXML("");
xmldoc.createElementWithTextValue("element_one", "test");
xmldoc.createElementWithTextValue("element_two", "new2 value");
var el = xmldoc.createElement("element_three");
xmldoc.setCurrentElement(el);
xmldoc.createElementWithTextValue("newChild", "test child element");
response.soapResponseElement = xmldoc.getDocumentElement();
```
Is used to accept the following request:
```
```
Which will respond with the following SOAP response:
```
test
new2 value
test child element
```
WSDL support will need to be created externally. The SOAP endpoint will need to be referred back to the scripted web service in question.
**Parent Topic:**[Scripted SOAP web services](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/web-services/c_ScriptedWebServices.md)