Enterprise Software

Easily test Web services with soapUI

The soapUI tool makes it much easier to test Web services during development. It's also useful for interacting with third-party Web services to get a better idea of what to expect (and what to include) in the response. See how to put soapUI to work.

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

Figure A

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.

Integration

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

Figure B

Figure B: Third-party tools may be integrated with soapUI via the Preferences window.

Getting soapUI

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!

About

Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a productio...

6 comments
Raja B
Raja B

Has anyone tried this against a webservice hosted in IIS that required windows authentication? I know this is not a core feature of this software but its a hurdle I have to get past to try this out.

JorgeA
JorgeA

Using a WSDL, SoapUI can creates mock web services and simulate behaving a server, accepting request and sending responses defined by user.

fcohen
fcohen

Hi Tony: That was a very nice review of soapUI. The mock service (or service virtualization) feature makes soapUI very valuable to agile development shops. Start with a SOAP service interface definition and with 3 clicks you have a working mock SOAP service. soapUI's support of XPath and Groovy mean the mock service responses include request data and can be programmed to be as complex or simple as needed. My company, PushToTest, provides professional training for soapUI and soapUI Pro. Details are at http://www.pushtotest.com/Docs/training/soapUI#top. We also provide technical support, consulting, and sell licenses to the Pro product. PushToTest TestMaker, the open-source test platform, ships with soapUI incorporated. TestMaker runs soapUI tests as functional test, load and performance tests, and business service monitors. TestMaker is a distributed test environment. Details on the integration are at: http://soapui.pushtotest.com. Thanks for the review. -Frank

Justin James
Justin James

Thanks for pointing out this tool. How do other people test their Web services? throw data at it? Manually create requests to it, or use a test harness? J.Ja

paper.bill
paper.bill

We know .NET likes to be in control and we are not worthy to see the underlying data. 'After the event' we use Microsoft Soap Toolkit 3.0 Trace Tool (from the MS site) to read about the miscommunication between disparate systems.

pablo.emanuel
pablo.emanuel

Basically, I let the .Net tools (WSDL.exe) create the stub components and use NUnit to unit-test those components. Since most of the time, I'm consuming web services through .Net clients, that works fine for me, although I understand that, should I consume them from another non-.Net client, that wouldn't be "unit" enough.