Example: soap_request

In the first example, the soap_request function sends a SOAP packet to http://api.google.com/search/beta2.

web_add_header("SOAPAction",
        "\"urn:GoogleSearchAction\"");

soap_request("StepName=google",
	"ExpectedResponse=AnySoap",
	"URL=http://api.google.com/search/beta2", 
	"SOAPEnvelope= "
	    "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
	    "<soap:Envelope "
	        "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "
	        "xmlns:soapenc=\""
	        "http://schemas.xmlsoap.org/soap/encoding/\" "
	        "xmlns:tns=\"urn:GoogleSearch\" "
	        "xmlns:types=\"urn:GoogleSearch/encodedTypes\" "
	        "xmlns:xsi=\""
	        "http://www.w3.org/2001/XMLSchema-instance\" "
	        "xmlns:xsd=\""
	         "http://www.w3.org/2001/XMLSchema\">"
	    "<soap:Body soap:encodingStyle=\""
	         "http://schemas.xmlsoap.org/soap/encoding/\">"
	    "<tns:doGoogleSearch>"
	        "<key xsi:type=\"xsd:string\">"
	         "j1bV/rJGA3o10po6iUtemzqHHbb4eH79</key>"
	        "<q xsi:type=\"xsd:string\">"
	         "LoadRunner</q>"
	        "<start xsi:type=\"xsd:int\">0</start>"
	        "<maxResults xsi:type=\""
	         "xsd:int\">10</maxResults>"
	        "<filter xsi:type=\"xsd:boolean\">false</filter>"
	         "<restrict xsi:type=\"xsd:string\" />"
	        "<safeSearch xsi:type=\"xsd:boolean\">"
	         "false</safeSearch>"
	        "<lr xsi:type=\"xsd:string\" />"
	        "<ie xsi:type=\"xsd:string\" />"
	        "<oe xsi:type=\"xsd:string\"/>"
	    "</tns:doGoogleSearch>"
	    "</soap:Body>"
	    "</soap:Envelope>", 
	"Snapshot=t1.inf", 
	"ResponseParam=result", LAST );

In the second example, the soap_request function uploads and downloads files.

web_add_header("SOAPAction", "\"\"");
// Soap_Request for upload file

soap_request("StepName=MimeUploadFileWithSoapRequest",
    "URL=http://myServer:8080/axis/services/MimeService",
    "SOAPEnvelope="
        "<?xml version=\"1.0\" encoding=\"UTF-8\"standalone=\"no\"?>" 
        <soap:Envelope xmlns:soap=\"http://sc"
        "hemas.xmlsoap.org/soap/envelope/\"
        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xm"
        "lns:xsd=\"http://www.w3.org/2001/XMLSchema\"
        "xmlns:tns=\"http://DefaultNamespace\" xmlns:types"
        "=\"http://DefaultNamespace\"
        xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"
        "<soap:Body soap:encodingStyle="
        "\"http://schemas.xmlsoap.org/soap/encoding/\">"
        "<tns:MimeUploadFile><"in0 xsi:type=\"xsd:string\">d"
        ":\\temp\\myUploaded1.txt</in0></tns:MimeUploadFile>"
        </soap:Body></soap:Envelope>",
        ATTACHMENTS_FORMAT_MIME,
        ATTACHMENT_ADD,"FileName=d:\\temp\\attachment.in",
        "ContentType=text/plain","Id=12345",
     LAST );

// Soap_Request for download file

soap_request("StepName=MimeDownloadFileWithSoapRequest",
    "URL=http://myServer:8080/axis/services/MimeService",
    "SOAPEnvelope="
        "<?xml version=\"1.0\" encoding=\"UTF-8\"
        "standalone=\"no\"?><soap:Envelope xmlns:soap=\"http://sc"
        "hemas.xmlsoap.org/soap/envelope/\"
        "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xm"
        "lns:xsd=\"http://www.w3.org/2001/XMLSchema\"
        "xmlns:tns=\"http://DefaultNamespace\" xmlns:types"
        "=\"http://DefaultNamespace\"
        xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"
        <soap:Body soap:encodingStyle="
        "\"http://schemas.xmlsoap.org/soap/encoding/\">
        <tns:MimeDownloadFile>"
        "<in0 xsi:type=\"xsd:string\">"
        "d:\\temp\\myUploaded.txt</in0></tns:MimeDownloadFile>"
        "</soap:Body></soap:Envelope>",
     ATTACHMENT_SAVE_BY_INDEX,
     "Index=1","ParamName=pAttachmentContent",
     LAST );