---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/de-DE/api-reference

 Release :

    - australia

ft:locale :

    - de-DE

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# SOAPMessageV2 - Scoped, Global

# SOAPMessageV2 - Scoped, Global {#ariaid-title1}

* Freigeben Version: Australia
* 
* Aktualisiert 12. März 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 11 Minuten Lesedauer

The SOAPMessageV2 API provides methods to send an outbound SOAP message using JavaScript.

Use this API to manage the response returned by the SOAP provider.

You can use this API in scoped applications or within the global scope. This API runs in the `sn_ws` namespace.  
See also:

* [Direct SOAPMessageV2 example](https://servicenow-prod.fluidtopics.net/GDOzi50kbKe_iMD9TE0q7g "You can send an outbound SOAP message directly to the endpoint.")
* [Recordless SOAPMessageV2
  example](https://servicenow-prod.fluidtopics.net/~ihUBYTsKJTzJjJ5vUzQPg "You can use the SOAPMessageV2() constructor with no parameters to define a SOAP message entirely in the script.")
* [Asynchronous SOAPMessageV2
  example](https://servicenow-prod.fluidtopics.net/ijgghkdGePOLpEHuw6d9jA "You can send an outbound SOAP message asynchronously.")
* [SOAPMessageV2 MID server
  example](https://servicenow-prod.fluidtopics.net/kvnMJLMeAwNBc_~f6K50iQ "You can send an outbound SOAP message through a MID Server.")
{#c_SOAPMessageV2API__ul_kh3_zx1_w4b}

## SOAPMessageV2 - SOAPMessageV2() {#ariaid-title2}

Instantiates an empty SOAPMessageV2 object.
When using an object instantiated this way, you must manually specify a SOAP action and
endpoint.
{#r_SMV2-SOAPMessageV2__table_vy2_525_jqz__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Tabelle : 1. Parameters]

{#r_SMV2-SOAPMessageV2__table_vy2_525_jqz}  

    var sm = new sn_ws.SOAPMessageV2();

## SOAPMessageV2 - SOAPMessageV2(String soapMessage, String soapFunction) {#ariaid-title3}

Instantiates a SOAPMessageV2 object from a SOAP message record and a function
associated with that record.
Values such as the endpoint, authentication, or MID Server settings from the
SOAP message record apply to this object.
{#r_SMV2-SOAPMessageV2_S_S__table_vy2_525_jq__entry__3}

| Name | Type | Description |
|-|-|-|
| soapMessage | String | SOAP message record you want to use as the base for this object. |
| soapFunction | String | SOAP function you want to execute. Available SOAP functions depend on the WSDL supplied by the web service provider. |
[Tabelle : 2. Parameters]

{#r_SMV2-SOAPMessageV2_S_S__table_vy2_525_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.

## SOAPMessageV2 - execute() {#ariaid-title4}

Sends the SOAP message to the endpoint.
This method calls synchronously, meaning that the script execution waits until the call completes before continuing.  
Things to consider when using this method:

* Only use this method for quick service calls. You shouldn't call this method in high volume no matter how quick the service.
* Only use this method when the timeout is very short, otherwise the instance can be brought to a standstill. There are two properties that control the timeout period, glide.http.timeout and glide.http.connection_timeout. By default, these timeouts are set to 175 seconds and 10 seconds respectively.
* Generally, if the request must go through the MID Server, you shouldn't use this method. MID Server requests must go through the External Communication Channel (ECC) queue which is an asynchronous queue. The thread isn't only held up by the request itself, but it's also held up waiting for the MID Server to respond back to the instance. If MID Servers are involved, use asynchronous calls with a sensor business rule.
{#r_SMV2-execute__ul_yyp_4c4_xcc}
{#r_SMV2-execute__table_vy2_525_jqn__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Tabelle : 3. Parameters]

{#r_SMV2-execute__table_vy2_525_jqn} {#r_SMV2-execute__table_qpt_3f5_jq__entry__2}

| Type | Description |
|-|-|
| [SOAPResponseV2](https://servicenow-prod.fluidtopics.net/ltIrVZM02oO5PGcyLSknGQ#c_SOAPResponseV2API "The SOAPResponseV2 API provides methods that use the data returned by an outbound SOAP message in JavaScript code.") | Response returned by the SOAP provider. |
[Tabelle : 4. Returns]

{#r_SMV2-execute__table_qpt_3f5_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var response = sm.execute(); //Might throw exception if http connection timed out or some issue with sending request itself because of encryption/decryption of password.

## SOAPMessageV2 - executeAsync() {#ariaid-title5}

Sends the SOAP message to the External Communication Channel (ECC) queue.
SOAP messages in the ECC queue are processed by the SOAPClient business rule.

By default, this business rule doesn't run asynchronously. To configure this business rule to run asynchronously, set the When value to `Async` and add `current.update()` to
the end of the Script. The instance doesn't wait for a response from the web service provider when sending a message through the ECC queue.
{#r_SMV2-executeAsync__table_vy2_525_jqo__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Tabelle : 5. Parameters]

{#r_SMV2-executeAsync__table_vy2_525_jqo} {#r_SMV2-executeAsync__table_qpt_3f5_jq__entry__2}

| Type | Description |
|-|-|
| SOAPResponseV2 - Scoped, Global | Response returned by the SOAP provider. Hinweis: Attempting to use the SOAP response object before the response has been processed may result in a timeout error. |
[Tabelle : 6. Returns]

{#r_SMV2-executeAsync__table_qpt_3f5_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var response = sm.executeAsync();

## SOAPMessageV2 - getEndpoint() {#ariaid-title6}

Gets the endpoint for the SOAP message.
{#r_SMV2-getEndpoint__table_vy2_525_jqp__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Tabelle : 7. Parameters]

{#r_SMV2-getEndpoint__table_vy2_525_jqp} {#r_SMV2-getEndpoint__table_qpt_3f5_jq__entry__2}

| Type | Description |
|-|-|
| String | URL of the SOAP web service provider. |
[Tabelle : 8. Returns]

{#r_SMV2-getEndpoint__table_qpt_3f5_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var endpoint = sm.getEndpoint();

## SOAPMessageV2 - getRequestBody() {#ariaid-title7}

Returns the content of the SOAP message body.
Hinweis:  
Before calling the getRequestBody() method, you must call the [execute()](https://servicenow-prod.fluidtopics.net/HTQJ7euJ6TPLOH~POx6JoQ#r_SMV2-execute "Sends the SOAP message to the endpoint.") method to obtain the response object. {#r_SMV2-getRequestBody__table_vy2_525_jqq__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Tabelle : 9. Parameters]

{#r_SMV2-getRequestBody__table_vy2_525_jqq} {#r_SMV2-getRequestBody__table_qpt_3f5_jq__entry__2}

| Type | Description |
|-|-|
| String | SOAP message body. |
[Tabelle : 10. Returns]

{#r_SMV2-getRequestBody__table_qpt_3f5_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","StockQuoteSoap.GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var response = sm.execute();
    var requestBody = response.getRequestBody();

## SOAPMessageV2 - getRequestHeader(String headerName) {#ariaid-title8}

Gets the value for an HTTP header specified by the SOAP client.
By default, this method cannot return the value for a header set automatically by the
system. To grant this method access to all headers, set the property glide.http.log_debug to
true.
{#r_SMV2-getRequestHeader_S__table_vy2_525_jqrr__entry__3}

| Name | Type | Description |
|-|-|-|
| headerName | String | Request header you want to get the value for. |
[Tabelle : 11. Parameters]

{#r_SMV2-getRequestHeader_S__table_vy2_525_jqrr} {#r_SMV2-getRequestHeader_S__table_qpt_3f5_jq__entry__2}

| Type | Description |
|-|-|
| String | Value of the specified header. |
[Tabelle : 12. Returns]

{#r_SMV2-getRequestHeader_S__table_qpt_3f5_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var header = sm.getRequestHeader("Accept");

## SOAPMessageV2 - getRequestHeaders() {#ariaid-title9}

Gets HTTP headers that were set by the SOAP client and the associated
values.
This method does not return headers set automatically by the system. To configure this
method to return all headers, set the property glide.http.log_debug to true.
{#r_SMV2-getRequestHeaders__table_vy2_525_jqr__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Tabelle : 13. Parameters]

{#r_SMV2-getRequestHeaders__table_vy2_525_jqr} {#r_SMV2-getRequestHeaders__table_qpt_3f5_jq__entry__2}

| Type | Description |
|-|-|
| Object | Object that maps the name of each header to the associated value. |
[Tabelle : 14. Returns]

{#r_SMV2-getRequestHeaders__table_qpt_3f5_jq}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var requestHeaders = sm.getRequestHeaders();

## SOAPMessageV2 - setAllowedRedirectURIs(Array Uris) {#ariaid-title10}

Sets one or more URIs allowed to be redirected to. Controlling the allowed outbound URIs reduces security concerns and helps prevent URL redirect attacks that send users to malicious sites.
For a more comprehensive means of redirecting URIs, see [UriMatcher - Scoped](https://servicenow-prod.fluidtopics.net/n8WO2kgRoib7SFH~n6Uccg#UriMatcherScopedAPI "Provides a method to check if a URI matches specified criteria for scheme, host, path, fragments, and presence of query parameters.").
{#r_SMV2-setAllowedRedirectURIs_A__table_qym_34c_jt__entry__3}

| Name | Type | Description |
|-|-|-|
| Uris | Array | One or more URIs allowed for redirection. Each URI must be listed in "string" format. |
[Tabelle : 15. Parameters]

{#r_SMV2-setAllowedRedirectURIs_A__table_qym_34c_jt} {#r_SMV2-setAllowedRedirectURIs_A__table_rym_34c_jt__entry__2}

| Type | Description |
|-|-|
| None |   |
[Tabelle : 16. Returns]

{#r_SMV2-setAllowedRedirectURIs_A__table_rym_34c_jt}  
The following example shows how to add a list of URLs allowed for redirection for a SOAP message function.

    // Redirection URI Allow list
    try {
    	var sm = new sn_ws.SOAPMessageV2('TemperatureConvert', 'TempConvertHttpPost.FahrenheitToCelsius');
    	sm.setAllowedRedirectURIs(['https://www.w3schools.com/', 'https://www.google.com']);

    	sm.execute();

    } catch(ex) {
    	var message = ex.getMessage();
    }

## SOAPMessageV2 - setBasicAuth(String userName, String userPass) {#ariaid-title11}

Sets basic authentication headers for the SOAP message.
Setting basic authentication headers using this method overrides basic authentication
values defined in the SOAP message record.
{#r_SMV2-setBasicAuth_S_S__table_vy2_525_jq1__entry__3}

| Name | Type | Description |
|-|-|-|
| userName | String | Username to use when authenticating the SOAP message. |
| userPass | String | Password for the specified user. |
[Tabelle : 17. Parameters]

{#r_SMV2-setBasicAuth_S_S__table_vy2_525_jq1} {#r_SMV2-setBasicAuth_S_S__table_kvg_2mh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 18. Returns]

{#r_SMV2-setBasicAuth_S_S__table_kvg_2mh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setBasicAuth("username","password");

## SOAPMessageV2 - setEccCorrelator(String correlator) {#ariaid-title12}

Associates outbound requests and the resulting response record in the ECC
queue.
This method only applies to SOAP messages sent through a MID Server. The correlator
provided populates the Agent correlator field on the ECC queue record
for the response. Provide a unique correlator for each outbound request to associate the
correct results in the ECC queue with the request when designing asynchronous automation
through a MID Server.
{#r_SMV2-setEccCorrelator_S__table_vy2_525_jq2__entry__3}

| Name | Type | Description |
|-|-|-|
| correlator | String | Unique identifier |
[Tabelle : 19. Parameters]

{#r_SMV2-setEccCorrelator_S__table_vy2_525_jq2} {#r_SMV2-setEccCorrelator_S__table_yfc_2mh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 20. Returns]

{#r_SMV2-setEccCorrelator_S__table_yfc_2mh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setEccCorrelator("unique_id");

## SOAPMessageV2 - setEccParameter(String name, String value) {#ariaid-title13}

Overrides a value from the database by writing to the SOAP message payload.
This method only applies to SOAP messages sent through a MID Server. Use
this method when a value from the SOAP message in the database is invalid, such as when the
endpoint URL is longer than the maximum SOAP endpoint field
length.  
These are valid values for the name parameter.

* source: The endpoint URL.
* name: The SOAP message function to run.
{#r_SMV2-setEccParameter_S_S__ul_cfp_wck_xq}
{#r_SMV2-setEccParameter_S_S__table_vy2_525_jq3__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the ECC parameter. |
| value | String | Value to assign to the specified ECC parameter. |
[Tabelle : 21. Parameters]

{#r_SMV2-setEccParameter_S_S__table_vy2_525_jq3} {#r_SMV2-setEccParameter_S_S__table_m3m_2mh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 22. Returns]

{#r_SMV2-setEccParameter_S_S__table_m3m_2mh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setEccParameter("source","http://very.long.endpoint");

## SOAPMessageV2 - setEndpoint(String endpoint) {#ariaid-title14}

Sets the endpoint for the SOAP message.
By default, the SOAP message uses the endpoint specified in the SOAP message record. Use
this method to override the default. You must call this method when using the [SOAPMessageV2()](https://servicenow-prod.fluidtopics.net/HTQJ7euJ6TPLOH~POx6JoQ#r_SMV2-SOAPMessageV2 "Instantiates an empty SOAPMessageV2 object.") constructor with no
parameters.
{#r_SMV2-setEndpoint_String_endpoint__table_vy2_525_jq4__entry__3}

| Name | Type | Description |
|-|-|-|
| endpoint | String | URL of the SOAP web service provider you want to interface with. |
[Tabelle : 23. Parameters]

{#r_SMV2-setEndpoint_String_endpoint__table_vy2_525_jq4} {#r_SMV2-setEndpoint_String_endpoint__table_pwq_2mh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 24. Returns]

{#r_SMV2-setEndpoint_String_endpoint__table_pwq_2mh_dr}  

    var sm = new sn_ws.SOAPMessageV2();
    sm.setEndpoint("http://web.service.endpoint");

## SOAPMessageV2 - setFollowRedirect(Boolean followRedirect) {#ariaid-title15}

Sets the parameter in the API that controls automatic HTTP redirects. By default, automatic redirects are turned off.
For additional information on HTTP redirects, see [Redirections in HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections).
{#SMV2-setFollowRedirect_B__table_nhg_cfb_vcc__entry__3}

| Name | Type | Description |
|-|-|-|
| followRedirect | Boolean | Flag that indicates whether the API should automatically follow any redirects that arise when executing the SOAPMessageV2 call. Valid values: * true: Automatically follow redirects. * false: Don't automatically follow redirects. You must handle all redirect conditions within your code. |
[Tabelle : 25. Parameters]

{#SMV2-setFollowRedirect_B__table_nhg_cfb_vcc} {#SMV2-setFollowRedirect_B__table_ohg_cfb_vcc__entry__2}

| Type | Description |
|-|-|
| None |   |
[Tabelle : 26. Returns]

{#SMV2-setFollowRedirect_B__table_ohg_cfb_vcc}  
The following code example shows how to set automatic redirects on and have the API handle the redirect.

    var sMessage = new sn_ws.SOAPMessageV2(); //Create an empty SOAP message
    sMessage.setBasicAuth('admin','admin');
    sMessage.setSOAPAction('http://www.service-now.com/incident/insert'); //set the SOAP action to perform
    sMessage.setEndpoint('http://<instance>.service-now.com/incident.do?SOAP'); //set the web service provider endpoint
    sMessage.setRequestBody('<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:inc=\"http://www.service-now.com/incident\"><soapenv:Header/><soapenv:Body><inc:insert><short_description>Test Dynamic SOAP</short_description></inc:insert></soapenv:Body></soapenv:Envelope>');
    sMessage.setFollowRedirect(true);
    var response = sMessage.execute();
    gs.info(response.getStatusCode());

Output:

    200

The following code example shows the automatic redirect set to false. The returned status code is a redirect code. In this case, you must handle the redirect within your code.

    var sMessage = new sn_ws.SOAPMessageV2(); //Create an empty SOAP message
    sMessage.setBasicAuth('admin','admin');
    sMessage.setSOAPAction('http://www.service-now.com/incident/insert'); //set the SOAP action to perform
    sMessage.setEndpoint('http://<instance>.service-now.com/incident.do?SOAP'); //set the web service provider endpoint
    sMessage.setRequestBody('<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:inc=\"http://www.service-now.com/incident\"><soapenv:Header/><soapenv:Body><inc:insert><short_description>Test Dynamic SOAP</short_description></inc:insert></soapenv:Body></soapenv:Envelope>');
    sMessage.setFollowRedirect(false);
    var response = sMessage.execute();
    gs.info(response.getStatusCode());

Output:

    3xx  // Redirect status code

## SOAPMessageV2 - setHttpTimeout(Number timeoutMs) {#ariaid-title16}

Sets the amount of time the SOAP message waits for a response from the web service
provider before the request times out.
{#r_SMV2-setHttpTimeout_N__table_vy2_525_jq5__entry__3}

| Name | Type | Description |
|-|-|-|
| timeoutMs | Number | Amount of time to wait for a response from the web service provider, in milliseconds. |
[Tabelle : 27. Parameters]

{#r_SMV2-setHttpTimeout_N__table_vy2_525_jq5} {#r_SMV2-setHttpTimeout_N__table_a1v_2mh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 28. Returns]

{#r_SMV2-setHttpTimeout_N__table_a1v_2mh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setHttpTimeout(6000);

## SOAPMessageV2 - setLogLevel(String level) {#ariaid-title17}

Sets the log level for this message and the corresponding response.
Setting a log level using the SOAPMessageV2 API overrides the log level configured on the
SOAP message record. This log level may not apply if the endpoint domain is excluded, or if
the property glide.outbound_http_log.override is true. To view outbound
web service logs, navigate to System LogsOutbound HTTP Requests.
{#SMV2-setLogLevel_S__table_lxw_gnc_sw__entry__3}

| Name | Type | Description |
|-|-|-|
| level | String | Log level. Valid values: * all * basic * elevated |
[Tabelle : 29. Parameters]

{#SMV2-setLogLevel_S__table_lxw_gnc_sw} {#SMV2-setLogLevel_S__table_mxw_gnc_sw__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 30. Returns]

{#SMV2-setLogLevel_S__table_mxw_gnc_sw}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setLogLevel("all");

## SOAPMessageV2 - setMIDServer(String midServerName) {#ariaid-title18}

Configures the SOAP message to be sent through a MID Server.
By default, the SOAP message uses the MID Server specified in the SOAP
message function record. Use this method to override the default.
{#r_SMV2-setMIDServer_S__table_vy2_525_jq6__entry__3}

| Name | Type | Description |
|-|-|-|
| midServerName | String | Name of the MID Server you want to send the SOAP message through. Your instance must have an active MID Server with the specified name. |
[Tabelle : 31. Parameters]

{#r_SMV2-setMIDServer_S__table_vy2_525_jq6} {#r_SMV2-setMIDServer_S__table_kgz_2mh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 32. Returns]

{#r_SMV2-setMIDServer_S__table_kgz_2mh_dr}

## SOAPMessageV2 - setMutualAuth(String profileName) {#ariaid-title19}

Sets the mutual authentication protocol profile for the SOAP message.
Setting a protocol profile using this method overrides the protocol profile selected for
the SOAP message record.
{#r_SMV2-setMutualAuth_S__table_vy2_525_jq7__entry__3}

| Name | Type | Description |
|-|-|-|
| profileName | String | Name of the protocol profile to use for mutual authentication. |
[Tabelle : 33. Parameters]

{#r_SMV2-setMutualAuth_S__table_vy2_525_jq7} {#r_SMV2-setMutualAuth_S__table_lh2_fmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 34. Returns]

{#r_SMV2-setMutualAuth_S__table_lh2_fmh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setMutualAuth("auth_profile_name");

## SOAPMessageV2 - setRequestBody(String requestBody) {#ariaid-title20}

Sets the body content to send to the web service provider.
When you set the body content using this method, variables in the body are not substituted
for parameters from the SOAP message function record. You must explicitly define all values
within the SOAP message body.
{#r_SMV2-setRequestBody_S__table_vy2_525_jq8__entry__3}

| Name | Type | Description |
|-|-|-|
| requestBody | String | Body of the SOAP message. |
[Tabelle : 35. Parameters]

{#r_SMV2-setRequestBody_S__table_vy2_525_jq8} {#r_SMV2-setRequestBody_S__table_qg3_fmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 36. Returns]

{#r_SMV2-setRequestBody_S__table_qg3_fmh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    var body = "<SOAP message body>";
    sm.setRequestBody(body);

## SOAPMessageV2 - setRequestHeader(String headerName, String headerValue) {#ariaid-title21}

Sets an HTTP header in the SOAP message to the specified value.
{#r_SMV2-setRequestHeader_S_S__table_vy2_525_jq9__entry__3}

| Name | Type | Description |
|-|-|-|
| headerName | String | Name of the header. |
| headerValue | String | Value to assign to the specified header. |
[Tabelle : 37. Parameters]

{#r_SMV2-setRequestHeader_S_S__table_vy2_525_jq9} {#r_SMV2-setRequestHeader_S_S__table_jml_fmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 38. Returns]

{#r_SMV2-setRequestHeader_S_S__table_jml_fmh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setRequestHeader("Accept","Application/json");

## SOAPMessageV2 - setSOAPAction(String soapAction) {#ariaid-title22}

Defines the SOAP action this SOAP message performs.
The WSDL for your web service provider lists SOAP actions you can perform. You must call
this method when using the [SOAPMessageV2()](https://servicenow-prod.fluidtopics.net/HTQJ7euJ6TPLOH~POx6JoQ#r_SMV2-SOAPMessageV2 "Instantiates an empty SOAPMessageV2 object.") constructor with no parameters.
{#r_SMV2-setSOAPAction_S__table_vy2_525_jq10__entry__3}

| Name | Type | Description |
|-|-|-|
| soapAction | String | SOAP action this SOAP message performs. |
[Tabelle : 39. Parameters]

{#r_SMV2-setSOAPAction_S__table_vy2_525_jq10} {#r_SMV2-setSOAPAction_S__table_ur5_fmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 40. Returns]

{#r_SMV2-setSOAPAction_S__table_ur5_fmh_dr}  

    var sm = new sn_ws.SOAPMessageV2();
    sm.setSOAPAction("GetQuote");
    //construct SOAP message by specifying endpoint and auth
    sm.execute();

## SOAPMessageV2 - setStringParameter(String name, String value) {#ariaid-title23}

Sets a variable with the specified name from the SOAP message record to the specified
value.
XML reserved characters in the value are converted to the equivalent escaped
characters.
{#r_SMV2-setStringParameter_S_S__table_vy2_525_jq11__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the SOAP message variable. |
| value | String | Value to assign to the specified variable. |
[Tabelle : 41. Parameters]

{#r_SMV2-setStringParameter_S_S__table_vy2_525_jq11} {#r_SMV2-setStringParameter_S_S__table_pdy_fmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 42. Returns]

{#r_SMV2-setStringParameter_S_S__table_pdy_fmh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setStringParameter("symbol","NOW");

## SOAPMessageV2 - setStringParameterNoEscape(String name, String value) {#ariaid-title24}

Sets a variable with the specified name from the SOAP message record to the specified
value.
This method is equivalent to setStringParameter but does not escape XML reserved
characters.
{#r_SMV2-setStrParamNoEscape_S_S__table_vy2_525_jq12__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of the SOAP message variable. |
| value | String | Value to assign to the specified variable. |
[Tabelle : 43. Parameters]

{#r_SMV2-setStrParamNoEscape_S_S__table_vy2_525_jq12} {#r_SMV2-setStrParamNoEscape_S_S__table_uqc_gmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 44. Returns]

{#r_SMV2-setStrParamNoEscape_S_S__table_uqc_gmh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setStringParameterNoEscape("symbol","NOW");

## SOAPMessageV2 - setWSSecurity(String keystoreId, String keystoreAlias, String
keystorePassword, String certificateId) {#ariaid-title25}

Sets web service security values for the SOAP message.
Setting security values using this method overwrites web service security values defined
for the SOAP message record.
{#r_SMV2-setWSSecurity_S_S_S_S__table_vy2_525_jq13__entry__3}

| Name | Type | Description |
|-|-|-|
| keystoreId | String | Sys_id of the Java or PKCS12 key store to use. |
| keystoreAlias | String | Alias that identifies the public and private keys. |
| keystorePassword | String | Password assigned to the key store record. |
| certificateId | String | Sys_id of the trusted server certificate. |
[Tabelle : 45. Parameters]

{#r_SMV2-setWSSecurity_S_S_S_S__table_vy2_525_jq13} {#r_SMV2-setWSSecurity_S_S_S_S__table_kyg_gmh_dr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Tabelle : 46. Returns]

{#r_SMV2-setWSSecurity_S_S_S_S__table_kyg_gmh_dr}  

    var sm = new sn_ws.SOAPMessageV2("StockQuote","GetQuote"); //Might throw exception if message doesn't exist or not visible due to scope.
    sm.setWSSecurity("70d65e074f3812001f6eac118110c71a","Quote keys","UXr82cqX75Z7MaSa+EyjGA==","ba969a074f3812001f6eac118110c76d");


