Jul 10, 2007

JMeter: Dynamic SOAP XML data of WebService(SOAP) Request

SOAP XML data of WebService(SOAP) Request could be set by,

a). "Soap/XML-RPC Data" text field directly or
b). reading from file or
c). randomly picking up from directory when data files stored.

When want to send dynamic soap xml data, say different user name, method a) doesn't work since it's hard coded; method c) works here as long as we generate the data files in advance.

How about method b)? It looks more neat, at least for me:) But how?

The way I could think about is using a Java Request before each WebService(SOAP) Request. In the Java Request, just use simple BufferedWriter writer = new BufferedWriter(new FileWriter("soapDataFile")) to generate the soap xml file which includes the dynamic user name variable read from user file. Since the xml is not complex, just regard it as text file, no bother to use the more professional heavy XML processing method like How to Read and Write RSS Feeds (Linked here just in case)

2 comments:

RAD KRISH said...

henry, thanks for the info. Being a beginner i can understand your concepts but i cant make it practically applicable. Can you pls explain in depth on how to automate the inputs of web services testing by the combination of java request and web service request.

Henry Wu said...

This post only record a simple way to feed jmeter some dynamic SOAP XML data: generate the xml files with username as variable (indirectly read from db or another user list file). Then use the generated xml files in jmeter. Good luck!