Summary of loadrunner test web service method

There are three ways to succeed:
Add Service Call method step
1. First, ask the developer to the address of wsdl. (In this example, http://IP:7001/sofa/services/com/yss/sofa/framework/test/services/WebService?wsdl is used) After opening, it should be an explanatory file in XML format. , Note: Need to add ?wsdl.
2. Open loadrunner, create a new script, use web services script protocol. After opening, the shortcut toolbar will be different from HTTP, as follows (used below the three buttons in the third row):

3. Click the Manage Services button, and in the upper left corner of the pop-up box, open the input wsdl address box.
4. Add the wsdl address just now in the opened address box, and then click Import. After that, you don't need to do anything directly to close the Manage Services window by clicking OK. So far, the information of this web service has been entered into the script configuration file.

5. Click the Add Services Call button to pop up the call interface of the corresponding method. The input is the input and the output is the output, which is the parameter and return value of the method. The method on the right is the method that can be called. Below the input are the parameters of the method. After clicking, the interface will pop up to input the parameter values ​​you want to bring.
  
6. Click OK, and the corresponding loadrunner request function will be generated.
    web_service_call( "StepName=getTestBeans_102",
        "SOAPMethod=WebService|WebServicePort|getTestBeans",
        "ResponseParam=response",
        "Service=WebService",
        "ExpectedResponse=SoapResult",
        "Snapshot=t1369381795.inf",
        BEGIN_ARGUMENTS,
        "arg0=5000",
        END_ARGUMENTS,
        BEGIN_RESULT,
        END_RESULT,
        LAST); At
this point, the script is completed and the playback is successful. If you are not assured, just Turn on all log playback to see all requests and responses to determine whether they are correct.
SOAP method steps
This method needs to parse the WSDL file to generate the corresponding XML document. I use the soapUI tool. Of course, if you are strong enough, you can manually translate the interpretation file.
1. The first and second steps are the same as above, so I won’t repeat them.
2. Open the soapUI tool (if you don't have one, go to the Internet to find and install it directly), click File to create a new soapUI project.

3. Enter the WSDL address in the pop-up box and click OK to confirm.

4. After the tool parses the XML feedback from the address, it will generate the corresponding function that can be operated. Double-click the generated project after parsing to see the parsed result.

5. Find Service Endpoints in the analysis result and find the address in the input box below, remember this address, you need to use it below.

6. Double-click the request on the left, and the corresponding XML file will be generated. Enter the parameter value you want to bring in in the middle of the parameter (<arg0>5000</arg0>). Then right-click the pop-up menu and select Save to save as an XML file.

7. Close soapUI and click Import SOAP button to open the new SOAP request interface. If Cannot inser outside a function pops up, it means that the input cursor position in the script is incorrect. Click Browse in the pop-up box to find the XML file you just saved.
  
7. After confirming, a larger input box will be automatically generated. Enter the address saved in step 5 in the URL input box.

8. Click OK to generate the SOAP script, as follows:
    soap_request("StepName=SOAP Request",                                        
        "URL=http://IP:7001/sofa/services/com/yss/sofa/framework/test/services/WebService",                                        
        "SOAPEnvelope="
        "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://services.test.framework.sofa.yss .com/\">"
            "<soapenv:

                "<ser:getTestBeans>"
                    "<arg0>5000</arg0>"
                "</ser:getTestBeans>"
            "</soapenv:Body>"
        "</soapenv:Envelope>",                                        
        "SOAPAction=",                                        
        "ResponseParam= response",                                        
        "Snapshot=t1369385831.inf",                                        
        LAST); At
this point, the script is completed and the playback is successful. If you are not at ease, open the full log playback to see all the requests and responses to determine whether it is correct.
POST request method step
1. Use the above soapUI tool to access the webservice interface, use the wireshark packet interception tool to follow the network packet, and find that the HTTP protocol is still used for access. Save the contents of the package.
2. Create an HTTP protocol script and use the insert->New Step button to add a user-defined request.

Where Method is written as POST to indicate a POST request.
URL write the address of wsdl.
Copy the body of the intercepted data packet directly in the body, and click OK to generate the corresponding function.
    web_custom_request("web_custom_request",
        "URL=http://IP:7001/acs/services/com/yss/acs/interfaces/Service?wsdl",
        "Method=POST",
        "TargetFrame=",
        "Resource=0" ,
        "Referer=",
        "Body=<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:int=\"http://interfaces.acs.yss .com/\"><soapenv:Header></soapenv:Header><soapenv:Body><int:getTransferCommands><arg1>2013-04-05</arg1><arg2>2013-04-05</arg2 ></int:getTransferCommands></soapenv:Body></soapenv:Envelope>",




2. The Add Service Call method occupies a lot of the resources of the press. On an ordinary PC, 25 users' CPU will reach 90%, while the SOAP method hardly occupies the CPU, and only 25% of the CPU is on 100 users. It is suspected that the former method needs to constantly read the configuration and address in Manage Services during the pressure process in the above scenario, so the CPU occupies particularly high.
3. The SOAP method cannot use the common association function web_reg_save_param for association, but needs to use the XML value manipulation function, and write an XML function before obtaining the value to tell the script the standard XML format of the acquisition. Research Two hours were unsuccessful, so I gave up after a while. After the POST request method is adopted, no difference is found with the past HTTP protocol scripts. The association and checkpoint operations are exactly the same. Just write the two boundaries in the XML on the left and right sides of the association. At this time, you need to pay attention to which data is associated. .
4. There is no other feeling at present, try to use the POST method when possible. If there is no conversion tool and you can't convert and cannot intercept the packet, then consider using the Add Service Call method.

Guess you like

Origin blog.csdn.net/u014179640/article/details/90766336