VuGen: Make SOAP Calls With The SOAP/WEB Protocol
Posted on Sep, 2012 by Admin
This post will attempt to explain how VuGen SOAP calls look by comparing the WEB/HTTP protocol and the SOAP protocol. Below is an example of raw XML that is received from a request.
<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<Authentication soap-env:mustUnderstand="1">
<UserID>xxxx</UserID>
<Password>xxxx</Password>
</Authentication>
<Application soap-env:mustUnderstand="1">user</Application>
</soap-env:Header>
<soap-env:Body>
<generateAuthenticationTokenRequest/>
</soap-env:Body></soap-env:Envelope>
In the example below “http://999.99.99.999” URL or IP of the server that will accept the request. In the body section “Body= -Insert XML data here”, copy in the XML code and escape all quotes within the request. Here is the Web/HTTP protocol version:
web_add_header("Content-Type","text/xml; charset=utf-8");
web_custom_request("web_custom_request_1",
"URL=http://999.99.99.999 ",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Body=
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<soap-env:Envelope xmlns:soap-env=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soap-env:Header>
<Authentication soap-env:mustUnderstand=\"1\">
<UserID>xxxx</UserID>
<Password>xxxx</Password>
</Authentication>
<Application soap-env:mustUnderstand=\"1\">user</Application>
</soap-env:Header>
<soap-env:Body>
<generateAuthenticationTokenRequest/>
</soap-env:Body></soap-env:Envelope>",
LAST);
And here is the same request with the SOAP Protocol:
soap_request("StepName=InitializeConnection","URL=http:// 999.99.99.999 ",
"SOAPEnvelope="
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<soap-env:Envelope xmlns:soap-env=\"http://schemas.xmlsoap.org/soap/envelope/\">"
"<soap-env:Header>"
"<Authentication soap-env:mustUnderstand=\"1\">"
"<UserID>xxxx</UserID>"
"<Password>xxxx</Password>"
"</Authentication>"
"<Application soap-env:mustUnderstand=\"1\">user</Application>"
"</soap-env:Header>"
"<soap-env:Body>"
"<createSessionRequest/>"
"</soap-env:Body>"
"</soap-env:Envelope>",
"Snapshot=t1.inf",
"ResponseParam=response",
LAST);
Note that there are quotes surrounding the “less than” < and “greater than” > signs for each part of the SOAP request sections line by line in the SOAP protocol, but the SOAP envelope in the body of the web/HTTP version does not have them (see the BODY section). The soap_request function requires all parts of the envelope (wrapped with greater and less than signs) to be in quotes. Also be aware of the quote in the SOAP call for the SOAPEnvelope= line. If the quotes are missing on the right side of SOAPEnvelop=, Vugen will return a compilation error.