JavaScript global method: doSOAPRequest

Issues a SOAP request to a specified URL.

Syntax

doSOAPRequest( URL, SOAPAction, XML, SOAP user ID, SOAP password, Connect Timeout, Read Timeout, Obsolete, Attachment object, AcceptFastInfoset );

Parameters

The following arguments are valid for this function:

Argument Data type Required Description
URL String Yes This argument specifies the URL to which the script should send an HTTP request. If the HTTP request requires SSL then the URL must start with https.
SOAPAction String Yes This argument specifies the SOAPAction value.
XML String Yes This argument contains the XML for an entire SOAP request including the SOAP envelope. Refer to the Web Service's WSDL to determine the proper format of the SOAP request.
SOAP user ID String No This argument contains the user ID to be used for the Basic Authorization HTTP header.
SOAP password String No This argument contains the password value to be used for the Basic Authorization HTTP header.
Connect Timeout Number No This argument specifies the number of seconds a SOAP request has to establish a connection before it times out.
Read Timeout Number No This argument specifies the number of seconds a SOAP request has to read data before it times out.
Receive timeout (Obsolete) Number No This argument is obsolete.
Attachment object Array No This argument contains a JavaScript array of Service Manager-defined Attachment objects or an empty array. See JavaScript object: Attachment for more information.
AcceptFastInfoset Number No To set the SOAP Message flag "acceptfastinfoset". Default value is 1. To turn "acceptfastinfoset" off: 0.

Return values

A string containing a SOAP response or an error message.

Description

This method sends a SOAP request to a remote server and returns the SOAP response.

Examples

Example 1 :

  • Sends a SOAP request to a delayed stock quote Web service and indicates SM accept the "fastinfoset" formatted SOAP message
  • Prints the SOAP response to the screen

This example requires the following sample data:

  • The URL to a delayed stock quote Web service
  • Stock symbol for company
var url = "http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx";
var action = "http://ws.cdyne.com/GetQuote";
var xml = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" 
    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" 
    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" 
    xmlns:s0=\"http://ws.cdyne.com/\">
    <soap:Body>
           <GetQuote xmlns=\"http://ws.cdyne.com/\">
           <StockSymbol xsi:type=\"s:string\">GOOG</StockSymbol>
           <LicenseKey xsi:type=\"s:string\">0</LicenseKey>
           </GetQuote>
    </soap:Body></soap:Envelope>";
var uid = null;
var pass = null;
var attachments = new Array();
var quote = doSOAPRequest( url, action, xml, uid, pass, 60, 60, null, attachments );
print( "The return value is: " + quote );

Example 2:

  • Sends a SOAP request to a delayed stock quote Web service and indicates SM does not accept the "fastinfoset" formatted SOAP message.
  • Prints the SOAP response to the screen

This example requires the following sample data:

  • The URL to a delayed stock quote Web service
  • Stock symbol for company
var url = "http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx";
var action = "http://ws.cdyne.com/GetQuote";
var xml = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" 
    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" 
    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" 
    xmlns:s0=\"http://ws.cdyne.com/\">
    <soap:Body>
        <GetQuote xmlns=\"http://ws.cdyne.com/\">
        <StockSymbol xsi:type=\"s:string\">GOOG</StockSymbol>
        <LicenseKey xsi:type=\"s:string\">0</LicenseKey>
        </GetQuote>
    </soap:Body></soap:Envelope>";
var uid = null;
var pass = null;
var attachments = new Array();
var quote = doSOAPRequest( url, action, xml, uid, pass, 60, 60, null, attachments, 0 );
print( "The return value is: " + quote );