Share this page

# silverlight_soap_request

Web Services Functions (SOAP, WEB_SERVICE, Silverlight)

Performs a SOAP request in a Silverlight environment.

    int silverlight_soap_request( const char *StepName,ExpectedResponse, URL, <XMLEnvelope>, [Attachments,] [const char *UserHandlerName], LAST );

StepName | The name of the step, as it appears in the test tree. Any text can be used.
ExpectedResponse | The type of response to accept. See details below.
URL | The URL (Uniform Resource Locator) of the web service to load.
XMLEnvelope | For the following list of required elements, use the following string format: "Element=value"SOAPEnvelope: the XML packet sent to the server.Snapshot: the name of the .inf file containing a snapshot of the step.ResponseParam: the name of the output parameter in which to store the server response.
Attachments | For details, see Attachment Specifications.
UserHandlerName | If the request contains binary data, the call includes: `"UserHandlerName=LrBinaryEncodingHandler"`
LAST | A marker which indicates the end of the List of specifications

The silverlight_soap_request function performs a SOAP request in a Silverlight environment. It sends a SOAP packet to the specified URL and receives the server response.

The expected response is one of the following:

Value | Effect
--- | ---
"ExpectedResponse=SoapResult" | Accept SOAP output responses and fail on SOAP faults.
"ExpectedResponse= SoapFault" | Accept SOAP faults and fail on SOAP output responses.
"ExpectedResponse= AnySoap" | Accept both SOAP output and SOAP fault responses.

This function is generated when you record a SOAP session over HTTP in a Silverlight environment without providing the WSDL file of the corresponding web service.

## Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure. Note that in many cases, this return value indicates the technical success of the function, and not the result. For example, a function that registers a string to be found in a subsequent step returns LR_PASS to indicate that the registration was successful. This does not indicate that the string was found in the server response.

## Parameterization

The following arguments may be parameterized: URL, XMLEnvelope, value (of elements).

## Example

In this example, the silverlight_soap_request function sends a SOAP packet to http://lab1server3/SL/NorthWindService.svc/bin.

    web_add_auto_header("Accept-Encoding", "gzip, deflate");
    web_add_auto_header("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Hewlett-Packard; GTB6.4; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
    web_add_header("Accept-Language",
        "he");

    web_url("SL",
        "URL=http://lab1server3/SL",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t1.inf",
        "Mode=HTML",
        LAST);

    web_url("SilverlightDemo.xap",
    "URL=http://lab1server3/SL/ClientBin/Release/SilverlightDemo.xap",
        "Resource=1",
        "Referer=",
        LAST);

    web_add_header("Content-Type", "application/soap+msbin1");
    silverlight_soap_request("StepName=GetProducts",
    	"URL=http://lab1server3/SL/NorthWindService.svc/bin",
    	"SOAPEnvelope=<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/"
    	"soap-envelope\" xmlns:a=\"http://www.w3.org/2005/08/addressing\"><s"
    	":Header><a:Action s:mustUnderstand=\"1\">http://tempuri.org/"
    	"INorthWindService/GetProducts</a:Action><a:MessageID>urn:uuid"
    	":9f76a6f6-a1aa-4654-b9bc-a975067c917c</a:MessageID><a"
    	":SequenceAcknowledgement><a:ReplyTo>http://www.w3.org/2005/08/"
    	"addressing/anonymous</a:ReplyTo></a:SequenceAcknowledgement><a:To s"
    	":mustUnderstand=\"1\">http://lab1server3/SL/"
    	"NorthWindService.svc/bin</a:To></s:Header><s:Body><GetProducts xmlns="
    	"\"http://tempuri.org/\"><productNamePrefix></productNamePrefix></"
    	"GetProducts></s:Body></s:Envelope>",
    	"Snapshot=t2.inf",
    	"ResponseParam=response",
    	"UserHandlerName=LrBinaryEncodingHandler",
    	LAST);

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: