soapUI Tips n Tricks – Part 1

soapUI is a nice little web services testing tool. While working with it, I came across many “gotcha” moments. Life would be perfect without “gotchas”, ain’t it? Apparently, we live in a real world which is not so perfect and we have to work around the problems at times and get ahead. Over period of time, I came across some problems in soapUI and figured out a solution / work-around to those problems. I thought it would be nice to document those as and when I come across those. So here I am documenting these in part 1. I say “part 1” because I anticipate many more problems and work-arounds to these to come in the near future as soapUI matures through its releases.

[Please note: the tips listed below, may or may not apply to your particular case, as it is highly possible that a problem in one version of soapUI is fixed in the next. Nevertheless, it helps having a list of these at hand in case yours happens to be one of them and for some reason, you don’t want to upgrade to the next release]

  1. I changed my SOAP Request as per new schema definition, Why do I still get “Schema Compliance” FAILED error?

    soapUI, by default, locally caches wsdl and schema definitions. You can change this behavior in soapUI’s preferences. In any case, if the web service schema changes on server, you need to right click on a given Binding and click on “Update Definition”. This will pop up a window where you can give the exact address of the web service which you would test your Binding and all requests associated with this Binding with. Once you update definitions all your requests shall start working fine.

  2. When I click in error log area, soapUI hangs !

    This was a known issue in soapUI 2.0.2. It probably is fixed in the releases afterwards. Best thing is do not click in error log trying to reach the exact location of error ( as you might be used to in your IDE ). Other alternative is to upgrade to newer release of soapUI.

  3. I am using xmlHolder object from groovyUtils. But xmlHolder.setNodeValue does not work! How do I set values on xml holder nodes?

    I found this problem in soapUI 2.0.2 again. Here is a workaround, instead of using syntax

    xmlHolder.setNodeValue(“//ns:books[1]/ns1:book[1]/ns1:Id[1]”, “1234”);

    use following syntax

    xmlHolder[“//ns:books[1]/ns1:book[1]/ns1:Id[1]”] = “1234”;

  4. I am using built-in context variable ‘projectDir’ and it gives me NullPointerException when I run the project using command line tool ‘’ !

    It seems ‘projectDir’ variable does not work when running project at command line. You have to use following technique instead:

    def groovyUtils = new context )

    //and then use

  5. I use soapUI on Mac. Somehow ‘CMD + C’ and ‘CMD + V’ does not work for copy and paste respectively!

    This was the weirdest behavior I came across in soapUI. There is a workaround though. I think soapUI gets confused between usual windows ‘Ctrl’ key and Mac ‘Ctrl’ key. So try ‘CTRL + C’ and ‘CTRL + V’ instead of ‘CMD’ key. Also sometimes, you might have to do ‘Ctrl + C’ and then to paste you might need to use ‘CMD + V’. But you get the point, try ‘Ctrl’ and ‘CMD’ keys interchangeably and you will get the desired behavior depending on your objective at that time.

  6. I cannot refer to testRunner object in my groovy assertion. How do I access a test-case or step therein from my groovy assertion?

    This was quite an interesting one. typically when you want to access a current test case you would use a syntax


    this works perfectly fine in a plain groovy step or setup or tear down scripts. However, when you try referring to testRunner within a groovy assertion step, soapUI throws exception. The workaround to this is accessing testCase or test step via ‘context’ object. So you can use a syntax

    context.getTestCase().getTestStepByName(“MyStep”) OR

    depending on your need.

  7. I opened up ‘preferences’ and changed some property. Now all my requests are failing !

    This was a bug in soapUI 2.5.1. What happens is the moment you open up ‘preferences’ and change anything. Doesn’t matter what it is that you changed, the ‘HTTP Version’ property under ‘Preferences > Http Settings Tab’, by default changes from 1.1 to 0.9. This makes all your SOAP requests fail. The workaround is open up ‘Preferences > Http Settings Tab’ and change ‘HTTP Version’ property to ‘1.1’ OR simply refrain from using 2.5.1 and go back to good old version of soapUI that was working for you 🙂

  8. soapUI inserts double xml ending tags in SOAP Requests!

    If your xml schema has a sequence of elements where ‘either or’ condition exists, soapUI somehow creates a double set of ending tags for one of the elements. For example: say your schema accepts either element or under a node as shown below:

      <!-- OR -->

    When you try to create default SOAP Request that has ‘person’ element OR even if you double click on existing SOAP Request (that you might have crafted very carefully) having ‘person’ element in it, soapUI somehow inserts one more ending tag for ‘licenseNumber’ or ‘memberNumber’ depending on whichever you are using. So for example, soapUI changes xml element in your request to look like:

     <licenseNumber>12345678</licenseNumber></licenseNumber> OR

    Naturally you are not aware that soapUI changed this element behind the scenes and you try to run this request and things just don’t appear to work the way they used to. The workaround to this problem is that do not double click on SOAP Request that you have already crafted carefully unless you really need to modify it. Of course, pay attention to elements that are ‘either or’ type in schema and you might need to manually adjust them if soapUI changes those behind the scenes. This was a very annoying bug in soapUI 2.0.2. However this has been fixed in soapUI 2.5 onwards. So your other alternative is to move to newer version of soapUI.

  9. How do I flash ‘alert’ type of UI message box within my groovy script execution?

    Many of you might already know the answer to this but I thought of adding this to the list because I don’t think its documented. You can use ‘’ to flash an alert type of message to the user from a groovy script within soapUI. For example:‘Sorry, you cannot execute this script unless database properties are set.’);

  10. How do I pretty print xml programmatically within my groovy script in soapUI?

    Many times you will need to capture request or a response or a part of it to an external file for a later review. You can do this within your groovy script in very many different ways that I perhaps cannot cover in this post. However, the xml string that you write to the file may not be ‘pretty’ formatted and indented. You can certainly make use of built-in soapUI object to do this for you. For example, in your groovy script:

    def xmlUtils = new
    //Say 'str' is the xml string you want to 'pretty' print
    //Format xml for easier viewing
    def prettyString = xmlUtils.prettyPrintXml(str)
    //Now use 'prettyString' string to write to a file or any other use that you might have 

    In fact there are many more methods on XmlUtils object that you can make use of. Refer to soapUI javadocs in order to understand how XmlUtils can help you.

I guess that’s it for part 1. Hope that helps till I come up with part 2.



26 Responses to “soapUI Tips n Tricks – Part 1”

  1. soapUI Tips n Tricks - Part 2 « < One Byte at a Time /> Says:

    […] – Part 2 April 18, 2009 — onebyteatatime This post is a follow up on my earlier post – soapUI Tips n Tricks – Part 1. I hope my readers find this post as much of use as the previous one. In this part, I shall try to […]

  2. Igor Says:


    I’m new to Groovy and I’m using SoapUI to automate some test cases. I’m wondering if you may help me understand in detail how to make SoapUI interact with Groovy. I mean, I see examples of groovy for SoapUi but don’t seem to catch where to put them, if create them as Groovy scripts and then how do I call them inside a test case? If you can provide me to a link where I can see this, I’d really appreciate it.

    Best regards and thanks in advance,

    • onebyteatatime Says:

      You will need to create a test-case in soapUI. Then you can add a test step to this test-case. This test step can be of different types: Groovy Step, SOAP Request step, Datasource step..etc. You need to add a new Groovy test step in your case. Once you add a groovy test step, it will appear as a step under your test-case on the left hand side. You double click on this test step and you shall see the editor on right hand side to add your groovy code here. write your groovy code and you can run it by clicking on play button at the top of the editor. You can refer to soapUI’s documentation for more details:

  3. Igor Says:

    Thanks a lot for the prompt/correct response.
    I was wondering if you could help me with this one.
    I have an HTTPTestRequest where I get a response and to this I added a contains assertion to it. I need in a groovy script to find out the value from this assert (from the previous HTTPTestRequest responded) and move it into a variable where I can know if it passed or not, by reviewing the variable’s content (VALID or FAILED)

    Thanks a lot in advance,

    • onebyteatatime Says:

      Assuming your test steps are in following sequence
      -“SOAPRequest1” with an assertion

      If any one of assertions fail for SOAPRequest1, then the test-case stops. That means you really don’t need to verify if assertion for SOAPRequest1 failed or not because GroovyScript1 shall execute if and only if SOAPRequest1 succeeds with all its assertions succeeding.

      Now it is possible that you might want to test the response of SOAPRequest1 for some value for e.g. SOAPRequest1 returns a boolean of some kind and you want to do something in GroovyScript1 based on this variable. If this is what you want then you would have to grab response of SOAPRequest1 into a groovy variable in GroovyScript1 and then using xpath to extract the value of variable you want and accordingly carry out your processing.

      hope that helps,


  4. Igor Says:

    Thanks a lot,

    I noticed what you mentioned, if I made the assert to fail on purpose the whole test case stopped. So, I’ll do as you suggest. Thanks again for your prompt and acurate response


    • onebyteatatime Says:

      I am glad it helped you. You can look at soapUI docs to find out how to parse response into a variable. Try using xml holder provided by soapUI. You can do something like:

      def holder = groovyUtils.getXmlHolder( “SOAPRequest1#Response” )

      //define your namespaces
      def ns1 = “”
      def ns2 = “”
      holder.namespaces[“ns1”] = ns1
      holder.namespaces[“ns2”] = ns2

      //let’s say if response should look like

      //now access xml element in response
      if (holder[“//ns1:parentElement[1]/ns2:childElement[1]”] == “true”)
      //do something
      } else {
      //do something else

      hope that helps,


  5. Igor Says:

    Thanks a lot. I was able to retrieve the information I was looking for. I have one question, is there a way of using a local variable in a TestCase that can be updated through the test steps inside the TestCase? I want to navigate through the web services and want to keel a log of basic information for the navigation. Wanted to add it to a variable to later on save it on SQLserver.

    Thanks in advance,

    • onebyteatatime Says:

      In your groovy script you can do:

      //assuming you store your value in variable ‘value’
      testRunner.testCase.setPropertyValue(“propname”, value)

      //throughout your groovy script or otherwise else where in //soapUI project you can access this value using following syntax
      //OR using property expansion as shown below, this gives you //proprname value on test case running currently

  6. Aji Says:

    import groovy.lang.GroovyObjectSupport

    def builder = new JsonGroovyBuilder()
    def books = builder.books {
    book = [title: “Groovy in Action”, author: “Dierk Konig”]
    book = [title: “Groovy in Action”, author: “Dierk Konig”]

    when i run this i get error
    1 compilation error:

    unable to resolve class JsonGroovyBuilder
    at line: 6, column: 15

    please help me resolve this?

    • onebyteatatime Says:

      You would need to import JsonGroovyBuilder() at the top. But let’s say if you are indeed importing the class correctly at the top in your code under soapUI and it still complains that it is unable to resolve JsonGroovyBuilder, then check your /bin/ext folder to make sure you have the java library (jar file) having JsonGroovyBuilder in here. If not, you will need to make sure that jar file having this class is in this folder.

      hope that helps,

      • Aji Says:

        yes , the jar files were already present. in the folder. I am still getting the error.

        What else could be the issue? Is any that any dependent jar files are missing ?

        this is the detailed error:
        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 3: unable to resolve class JsonGroovyBuilder @ line 3, column unable to resolve class JsonGroovyBuilder @ line 3, column 15. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError( at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail( at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail( at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression( at org.codehaus.groovy.control.ResolveVisitor.transform( at org.codehaus.groovy.control.ResolveVisitor.transformDeclarationExpression( at org.codehaus.groovy.control.ResolveVisitor.transform( at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement( at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit( at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement( at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement( at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement( at

      • onebyteatatime Says:

        You will have to find out step by step:
        1. make sure you are indeed importing this class at the top of your script with an explicit import statement.
        2. make sure that the jar file ( one you think has this class ) really has the class JsonGroovyBuilder inside it. You can extract this jar file some place, follow the exact package structure and find out if the class exists.
        3. make sure this particular jar file is indeed in bin/ext folder under soapui installation folder.
        4. lastly if you are trying to use one of the default groovy libraries that soapui relies on then you should make sure that jar file exists in /lib folder under soapui installation folder. the bin/ext under soapui installation folder is meant for third party libraries only.

        hope that helps,

  7. Tanu Says:


    I started using SoapUI recently and was trying to automate some tests through it. I was trying to execute API in a loop where the datasource will have more than one output. Is there a way I can write the output for all the executions in a particular file? I tried datasink with ‘file’ option but the file is not getting written.

    Thanks in advance,

  8. Tanu Says:


    I am not using Groovy and I dont know about Java much. Please tell me how can I make SoapUI redirect the response of an API request in a file or XLS.


    • onebyteatatime Says:

      I did read your earlier message as well. It sounds like you need to save the response of a SOAP Request to a file. You perhaps want to do this in a loop where your requests are generated using datasource and responses coming back need to be stored some place. In any case, using datasink may not be a good idea. I had played with datasink quite a while ago and I have had problems too. So I started using simple groovy to save the results to the file. All you have to do is
      1. write a groovy script step that gets executed after all of your steps that make your response or any data that you want available to you.
      2. for e.g. say you have number of steps lined up and last SOAP Request step is called “FinalRequest”. Say you need response of this step to be stored in a file.
      3. Now you define a new groovy step, say, “SaveToFile” that gets executed after “FinalRequest” step.
      4. In your groovy step, you simply use property expansion to get access to your response from “FinalRequest”. for e.g.

      //before hand you create the name-path of file you want to save results to. remember this name shall be unique and generated based on some parameters that are unique to your loop
      def requestFilePath = …
      def responseFilePath = …

      //store xml in variables to be written to the file
      def requestXml = context.expand( ‘${FinalRequest#Request}’ )
      def responseXml = context.expand( ‘${FinalRequest#Response}’ )

      //now use requestFileName to store results to this file
      def writer=new File(requestFilePath).newWriter()
      writer.write( requestXml )

      writer=new File(responseFilePath).newWriter()
      writer.write( responseXml )

      hope that helps.


  9. Gunjan Says:

    Hi I was using soapui-2.0.2 but was getting Out of memory exception when truying to attach a file above 300 MB, so we decided to migrate to saopui-3.5.1 but still the error remains the same. We tried increaing
    In,, and all the files have been given the java heap setting properties of max heap size as 1024m and min as 128m.

    Please help us in resolving this, we are a kind of blocked now

    java.lang.OutOfMemoryError: Java heap space

    at java.util.Arrays.copyOf(


    at javax.activation.DataHandler.writeTo(Unknown Source)

    at javax.mail.internet.MimeBodyPart.writeTo(

    at javax.mail.internet.MimeBodyPart.writeTo(

    at javax.mail.internet.MimeMultipart.writeTo(


    at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.initHeaders(

    at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.(

    at com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse.(


    at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.wsdlRequest(

    at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.afterAbstractHttpResponse(

    at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.afterRequest(

    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(


    at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(

    at com.eviware.soapui.impl.wsdl.WsdlRequest.submit(


    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStep(

    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(

    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(


    at java.util.concurrent.Executors$

    at java.util.concurrent.FutureTask$Sync.innerRun(


    at java.util.concurrent.ThreadPoolExecutor.runWorker(

    at java.util.concurrent.ThreadPoolExecutor$


    12:49:40,286 ERROR [WsdlSubmit] Exception in request: java.lang.Exception: java.lang.OutOfMemoryError: Java heap space

    12:49:40,286 ERROR [SoapUI] An error occured [java.lang.OutOfMemoryError: Java heap space], see error log for details

    • sachinsawe Says:

      Try increasing memory to 2048m. If not, I suggest you definitely contact soapui support on their website. They are very helpful and pretty prompt in getting back if you have purchased the software from them. Also cannot imagine a use case where you would need to attach 300MB file. May be you should revisit what you are doing. Perhaps you don’t need to attach such a HUGE file. Good Luck !


  10. VJ Says:


    Thanks a lot for the deatiled answers for the commonm questions. Though you wrote that the 9th point is quite simple and well known, but I was an exception, I did not know it and wanted to get an answer.
    Thanks a lot for posting this. this is quite helpful. Looking forward for many of such things from you.


  11. Balu Says:


    rightnow i am using the soapUI tool, i have one problem in that , i have parameterised all the test cases using soapUI tool. But the username and password will get changing every one hour , so i can’t parameterise in the soapUI. is there any mechanism to parameterise that too?

    Please visit my blogpsot if any details,

  12. jonrh Says:

    Thanx for this writing those tips! It would though seem to me that tip #6 is no longer valid, the correct way (when this was written at least) according to Eviware is to use the ‘messageExchange’ object. For further details see the chapter “1.1. Get and Set properties” at:


  13. zorban Says:


    I am using soupUI API-4.0.0.jar for running SoupUI Test cases.
    When I run my unit test case,First few test cases run and last few test cases will fail because fo out of memory error. Please see the stack trace below.

    19:30:07,943 INFO [WsdlProject] Loaded project from [file:/D:/eclipse%20workspace/testSoapUI/sample-webservice.xml]
    19:30:14,414 ERROR [AbstractTestRunner] Exception during Test Execution
    java.lang.OutOfMemoryError: Java heap space
    at sun.nio.cs.UTF_8.newDecoder(Unknown Source)
    at java.lang.StringCoding$StringDecoder.(Unknown Source)
    at java.lang.StringCoding$StringDecoder.(Unknown Source)
    at java.lang.StringCoding.decode(Unknown Source)
    at java.lang.String.(Unknown Source)
    at Source)
    at Source)
    at java.util.jar.Manifest.(Unknown Source)
    at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
    at java.util.jar.JarFile.getManifest(Unknown Source)
    at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
    at Source)
    at$000(Unknown Source)
    at$ Source)
    at Method)
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at com.eviware.soapui.model.propertyexpansion.resolvers.MockRunPropertyResolver.resolveProperty(
    at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(
    at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(
    at com.eviware.soapui.model.propertyexpansion.DefaultPropertyExpansionContext.expand(
    at com.eviware.soapui.model.propertyexpansion.DefaultPropertyExpansionContext.get(
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext.getProperty(
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(

    I tried increasing memory heap size in soupui.bat file but the error persisted
    Please let me know how to resolve the same.

    • sachinsawe Says:

      From what I hear soapui 4 does have memory issues. Check with their support and you will know for sure. For now I would stay away from 4.0 and keep using the last stable version which I suppose is 3.6.1


      • zorban Says:

        Hi Sachinsawe,

        Thanks for the reply. I tried using 3.6.1.jar. Now it is running more test cases than before but issue – Out of memory still exists. I mean Now it runs 4 out of 5 Test cases and throwing out of memory error for the 5th one.

  14. Abi Says:


    I use the following syntax to run thesyntax to run soapui file in command prompt.

    C:\Program Files (x86)\SmartBear\soapUI-Pro-4.5.1\bin>testrunner.bat -i -r C:\Us
    ers\RBIQA\Desktop\SoapUI Sample\FreeTrialassert.xml

    But I get error saying “Missing soapUI project file”. I am currently using soapui pro 4.5.1. Can you help me with this issue? it is important in my project to run the file externally (say from command prompt)

    Thanks in advance.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: