10 Dec Micro Focus VuGen Web Services ~ Being an Effective Student
The Micro Focus “Web Services” Virtual User Generator protocol can be cryptic to the uninitiated, however, two ways to add content to this kind of script can become more understandable using the analogy of a student.
- Being a “Student who reads the Text Book” (Gold Star to the right)
- Being a “Student who copies off somebody else” (Silver Splat in the middle)
“A Student Who Reads the Text Book”
VuGen can import the “textbook”, aka WSDL, of the Web Service, thus being a good student of the Web Service. (A WSDL, by the way, is a description or a contract which declares to clients, what the web service provides, and what arguments must be sent, and what you will get back (if you ask nicely.) After importing the WSDL, adding new Web Service calls to the script can be easily done, but you must know what arguments are necessary to interact with the service. This requires research or examples of the SOAP requests.
- Have the WSDL URL ready
- Import the WSDL [ VUGen/SOA Tools → Manage Services → Import ]
- Have real knowledge of SOAP Request arguments ready
- Add a Web Service Call [ VUGen/SOA Tools → Add Service Call ]
- Select the Service, Operation, PortName, and enter any appropriate Input Arguments
Below is a simple call to a Calculator Web Service to add two integers 222 and 333.
web_service_call( "StepName=Add_101", "SOAPMethod=Calculator|CalculatorSoap|Add", "ResponseParam=response", "Service=Calculator", "ExpectedResponse=SoapResult", "Snapshot=t1526324673.inf", BEGIN_ARGUMENTS, "intA=222", "intB=333", END_ARGUMENTS, BEGIN_RESULT, "AddResult=Param_AddResult", END_RESULT, LAST);
CRITICAL CAVEAT / BEWARE / DO NOT IGNORE!
If you decide to use this method, you MUST ENSURE that you can install WSE 2.0 SP3 and WSE 3.0 Microsoft components on your Load Generators so that the web_service_call() will work. For more information, review the Micro Focus helpful online website here “Troubleshooting and Limitations for Web Services”.
“A Student Who Copies Off Somebody Else”
Now you and I both know in school we were rightly taught not to copy off someone else’s work. However, there are many situations in life where we learn by imitating what someone else is doing. Whether it’s learning how to use a table saw, or play a jazz riff on the piano, there’s a lot to be said for copying.
As for VuGen, a slightly more direct method of adding content to a Web Services script is to import an actual SOAP Request message that you were able to capture using any means possible. I got a valid request by using SoapUI.
- Have the SOAP Request XML file handy
- Know the “URL” for the Web Service
- Know the SOAP Action name (Found in the actual WSDL by keyword “soapAction”)
- [ VUGen / SOA Tools → Import SOAP ]
- Fill in the fields with the right data and you’re good to go.
Here’s what the result looks like in the VuGen script.
soap_request("StepName=SOAP Request", "URL=http://www.dneonline.com/calculator.asmx", "SOAPEnvelope=" "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" "<soapenv:Header></soapenv:Header>" "<soapenv:Body>" "<tem:Add>" "<tem:intA>4444</tem:intA>" "<tem:intB>5555</tem:intB>" "</tem:Add>" "</soapenv:Body>" "</soapenv:Envelope>", "SOAPAction=http://tempuri.org/Add", "ResponseParam=responseAddResult", "Snapshot=t1537996010.inf", LAST);
Note about Micro Focus Online Resources
Of the four methods identified on the Micro Focus site to add content to a Web Services script, this blog has discussed the 2nd and 3rd options listed in the ADM Help Site article Adding Web Service Script Content – Overview
1 Recording a Web Services Script
2 Adding New Web Service Calls ← GOOD STUDENT WITH TEXTBOOK
3 Importing SOAP Requests ← COPYING STUDENT
4 Analyzing Server Traffic