 <p>Don't reinvent the wheel, building a custom testing software mini empire from scratch. Use SOAPUI open source version to test web services. It allows you to:</p> <ul> <li>generate SOAP tests from web service endpoint WSDL, saving manual labour</li> <li>avoid processing "pre-canned" SOAP strings and parsing files </li> <li>automatically generate mocks of your service endpoints, including ability to programmatically control custom responses. </li> <li>implement test step logic including loops, branches, invoking other test steps, running scripts, and reading/writing parameters from/to property files and data sources (although you must programatically navigate &amp; modify XmlHolder instances via scripts if you wish to "data-drive" your tests)</li> <li>Execute SOAP, REST, security &amp; load testing of web services, and also JDBC and HTTP test calls. </li> <li>Integrates with the common build and continuous integration tools for test automation (TDD &amp; continuous delivery). </li> <li>Use SOAPUI operations within your IDE, via plugins. </li> </ul> <p>It's considered fairly standard "best practice" for testing web services.</p> <p>To checks SOAP response messages for valid content, using the open source version of SOAPUI:</p> <ul> <li>you can use <a href="http://www.soapui.org/Functional-Testing/xpath-and-xquery-assertions.html" rel="nofollow">XPath or XQuery expressions to validate the XML</a>.</li> <li><p>you can use <a href="http://www.soapui.org/Functional-Testing/script-assertions.html" rel="nofollow">script assertions</a></p> <p>E.g. if your SOAP response is:</p> <pre><code> &lt;soap:Body&gt; &lt;GetEnumResponse xmlns="http://www.xyz.com/"&gt; &lt;GetEnumResult&gt; &lt;ErrorCode&gt;0&lt;/ErrorCode&gt; &lt;StatusId&gt;0&lt;/StatusId&gt; &lt;/GetEnumResult&gt; &lt;enumsInformation&gt; &lt;EnumInformation&gt; &lt;TransactionId&gt;0&lt;/TransactionId&gt; &lt;ConstraintId&gt;5000006&lt;/ConstraintId&gt; &lt;EnumValue&gt;xyz&lt;/EnumValue&gt; &lt;Index&gt;10&lt;/Index&gt; &lt;/EnumInformation&gt; &lt;/enumsInformation&gt; &lt;/GetEnumResponse&gt; &lt;/soap:Body&gt; </code></pre> <p>You can script:</p> <pre><code> import com.eviware.soapui.support.XmlHolder def holder = new XmlHolder(messageExchange.responseContentAsXml) holder.namespaces["tal"]="http://www.xyz.com/" def node = holder.getNodeValue("//tal:ConstraintId[1]"); log.info(node); assert node == "5000006"; </code></pre></li> <li><p>You can even use the maximum power of standard java regex processing. </p> <p>Create java classes that do the regex processing and put them into a jar file and place in soapUIinstallation/bin/ext as explained <a href="http://technicaltesting.wordpress.com/tag/soapui/" rel="nofollow">here</a>.</p> <p>Or wrap your SOAPUI Test inside a JUnit test method, and add standard java code at end to check regexs. This also eases test automation &amp; allows any non-web service tests to be executed as well. This approach works with SOAPUI open source version, whereas the alternative of using SOAPUI assertion steps requires the Pro version.</p> <p>Steps:</p> <ol> <li>If you choose, install the SOAPUI plugin in your IDE</li> <li>Use SOAPUI to create a test suite</li> <li>Use SOAPUI to create test case(s) within the test suite</li> <li>Use SOAPUI to create test step(s) within the test suite. This is the core of using SOAPUI. </li> <li>Create a Java project in your IDE. Within this project, add a JUnit test case.</li> <li>Add all JARs from SoapUI bin and lib directories to Java Build Path.</li> <li>Within the Junit Test case, add code to execute a SOAPUI test step</li> <li>Obtain the MessageExchange object, get the response from it, and then get headers, content or attachments. Run a regex check on result.</li> </ol> <p>The following is indicative only. Not intended to be a working example.</p> <pre><code> package com.example; import org.junit.Test; import com.eviware.soapui.tools.SoapUITestCaseRunner; public class SoapUIProject { // runs an entire SOAPUI test suite @Test public void soapTest1() throws Exception { SoapUITestCaseRunner runner = new SoapUITestCaseRunner(); runner.setProjectFile("/path/to/your/W3Schools-Tutorial-soapui-project.xml"); runner.run(); } // runs a single SOAPUI test step - and checks response matches a regex @Test public void soapTest2() throws Exception { WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" ); TestSuite testSuite = project.getTestSuiteByName("My Test Suite"); TestCase testCase = testSuite.getTestCaseByName("My Test Case"); TestCaseRunner testCaseRunner = new WsdlTestCaseRunner(testCase,null); // Must have test step setup as WsdlMessageExchange for cast to work WsdlMessageExchangeTestStepResult testStepResult = (WsdlMessageExchangeTestStepResult)testStep.runTestStepByName("My Test Step"); // TestStep testStep = testCase.getTestStepByName("My Test Step"); // TestCaseRunContext testCaseRunContext = new WsdlTestRunContext(testStep); // testStep.prepare(testCaseRunner, testCaseRunContext); // WsdlMessageExchangeTestStepResult testStepResult = (WsdlMessageExchangeTestStepResult)testStep.run(testCaseRunner, testCaseRunContext); MessageExchange[] messageExchanges = testStepResult.getMessageExchanges(); for (MessageExchange me : messageExchanges) { String response = me.getResponseContentAsXML(); // do any desired regex processing // can use any desired assertions } assertEquals( Status.FINISHED, runner.getStatus() ); } } </code></pre></li> </ul> <p>Further refs: <a href="http://www.soapui.org/Scripting-Properties/tips-a-tricks.html#3-xml-nodes" rel="nofollow">http://www.soapui.org/Scripting-Properties/tips-a-tricks.html#3-xml-nodes</a> <a href="http://books.google.com.au/books?id=DkWx7xZ263gC&amp;printsec=frontcover#v=onepage&amp;q&amp;f=false" rel="nofollow">http://books.google.com.au/books?id=DkWx7xZ263gC&amp;printsec=frontcover#v=onepage&amp;q&amp;f=false</a></p>