VuGen: Make SOAP Calls With The SOAP/WEB Protocol

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.

What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events



  • Luca Mariani

    Hi, my company has request a test on a ws implemented token and X.509 certificate as part of authentication.The certificates are in .keystore format.
    I can not set the instrument properly for authentication. Can you help me? I’ve Loadrunner 11.5 with ws protocol.
    Thanks.