SOA and Web services have revolutionized the way we work with Web applications and exchange data, but they can be very difficult to debug problems during development. There are numerous options available depending upon your development environment. The caveat is working with a Web service — yours or a third-party — once it has been rolled out. This is where the soapUI tool enters the picture.
Features of soapUI
The soapUI is designed to simplify the testing of your Web services; I also find it useful for interacting with third-party Web services to get a better idea of what to expect in the response, as well as what to include in the response. It was especially useful in a recent project utilizing ChannelAdvisor Web services. Using soapUI, I was able to figure out the data expected in request objects.
SoapUI is accessible to both technical and nontechnical persons. The easy-to-use graphical interface makes it simple to work with WSDL and SOAP-based Web services. It provides a Web service client that can automatically generate Web service requests and tests.
With the tool, you can work with XML and its many variations like WSDL. WSDL is easily imported via its URL, along with a great viewer for navigating and inspecting the WSDL source.
SoapUI offers extensive security features, which include Web service authentication and WS-Security. One of the cool features I like is the excellent SOAP monitor support; it allows you to easily monitor and analyze traffic.
The user interface is powerful; the soapUI tool also provides a command-line option. It allows you to run your tests via the command line, thus it can be easily automated in batch files.
Putting soapUI to work
Figure A provides a look at the soapUI interface with a new project created to access the Amazon S3 Web service. It includes the generation of a new request for the Web service’s CopyObject method. A new request is generated by right-clicking a method name (in the left side of the IDE) and selecting New Request.
With the request generated, you can fill in the necessary data and submit the request via the green Play button in the upper left of the request window. A validation option is available as well to ensure the request XML is valid before you try to submit it. Once you submit a request, you can view the results to see the response (if there is one) from the Web service call.
Figure A: A new soapUI project created for the Amazon S3 Web service.
The ability to create mock objects is available within soapUI. It allows you to test a Web service without actually connecting to it. The feature is available by right-clicking a method.
In addition to running a request, you may create a new assertion for testing. The left pane (navigation area) of the IDE includes a node for Tests. This allows you to create new tests and test scripts for validation proper Web service execution.
SoapUI easily integrates with IDEs and other tools to become a part of your development process. The list of IDEs includes Maven, NetBeans, IntelliJ IDEA, JBoss, and Eclipse. The other tools include code generation and WS-I options. Tools may be associated with soapUI via the Preferences window, as shown in Figure B, which include the configuration for the .NET wsdl.exe tool.
Figure B: Third-party tools may be integrated with soapUI via the Preferences window.
The soapUI tool is built with Java. The necessary Java files may be installed when soapUI is installed. Its reliance on Java means it can run on many platforms. The download page includes Windows installation files as well as tar files for other systems.
A great aspect of soapUI is its cost — free! Well, the Basic version is available at no cost. A Pro version is available with a one year license for $349. The professional version includes everything that’s in the Basic version, along with product support and additional features for testing such as refactoring, data sources, and drag-and-drop editing.
Don’t forget to test
Testing is an important aspect of every development project. It seems common to test a Web service as part of a bigger system via how the Web service is accessed. However, it is important to fully test the service itself. The soapUI tool allows you to easily write test suites and test cases.
A better way
The soapUI tool provides a great way to interact with and test Web services whether they are your own or third-party offerings. It is a nice alternative to other options I’ve used, such as the built-in features of Visual Studio or hand-coding SOAP requests.
How do you handle the testing phase for Web services? What tools are in your development toolbox? Share your thoughts and experience with the Web Developer community.
Tony Patton began his professional career as an application developer earning Java, VB, Lotus, and XML certifications to bolster his knowledge.
Get weekly development tips in your inbox
Keep your developer skills sharp by signing up for TechRepublic’s free Web Developer newsletter, delivered each Tuesday. Automatically subscribe today!