INTERNET APPLICATION DEVELOPMENT
MID MARKET ERP DEVELOPMENT
by Derek Du
Among several web service test tools I use, including WCFStorm, VS WCF Test Client, and other proprietary test tools, soapUI is my favorite. In a recent project, with the help of soapUI, I was able to add custom fields into an HTTP header, compose the authentication header field, and POST JSON data to a REST web service. Here’s a quick guide on how to add REST web services to soapUI and post JSON to the services.
Step 1: Create a new project.
Step 2: Input fields.
Provide a name and select the option Opens dialog to create REST service. Click OK.
In the next screen, provide the web service’s URL and select the option Extract Resource and Method from the specified Endpoint, so that SoapUI can analyze the URL and find out the parameters in it. In my example, the parameters that are extracted are Site ID and User ID. Click OK.
You can define the parameter names and default values on the next screen. Click OK.
Step 3: Setup your method.
This includes HTTP method and parameters. We will select POST here to demonstrate how to post JSON. Click OK to finish creating the method.
Now we can go ahead to expand our project and method, and select the request just created. On the right pane, our parameters and end-point are displayed.
Step 4: Modify the Media Type.
Type application/json in the Media Dropdown list since it is not an option. Then type the JSON you want to post. Click on the green arrow on the left upper corner of the request. soapUI will post the data to the endpoint.
Click on the Raw tab to view the raw data just posted!
As you can see, SoapUI is a very flexible and effective tool which offers a free, quick, and simple solution to test web services.