soapUI War Mock, Script Dispatcher and WebLogic Server
Test and Monitor | Posted November 15, 2011

Customer Guest Post by: Maria Isabel Rodrigues

This post is for those that are familiar with soapUI but are having a hard time putting a mock war to work on a Weblogic Server.

I am working on a project that needs to consume some web services. These web services don’t exist yet, so I thought I’d use soapUI to mock them. This way I don't need to wait till they are completed and I can keep doing my work. That solution was perfect for running the project locally but at some point I found out that the environments I would need to deploy the project (development, test, …) don’t have soapUI installed and don’t allow me to install it either.

soapUI has a feature that creates a war to expose your soapUI mock on a Web Server and that is perfect for my case. Since soapUI is tested only on Tomcat, I found some issues when running its war on the Weblogic Server. This post will present the steps on how to create a war mock using SCRIPT dispatcher and deploy it successfully on a Weblogic Server, as well as the issues I found (described as #number).

  1. First of all, you'll need to have a wsdl.

    #1 - There is a schema path problem when accessing the wsdl from the mock deployed in Weblogic, if the schema code is imported as a xsd file into the wsdl. I don't have a solution for it, just a workaround. Put the schema code in the wsdl file and you should not have this problem.

    The ExampleWS.wsdl is attached as an example.

  2. With the wsdl, create a soapUI Project. Then, create a mock service.

    The Example-soapui-project.xml is attached as an example.

  3. Open MockOperation Editor (for ExampleWS it's the GetUser operation from the MockService). Select dispatch SCRIPT and fill in the script field as in the following image.

    #2 - Instead of using the default SEQUENCE dispatcher, I want to explain how to use a SCRIPT dispatcher that works on Weblogic. That was pretty tricky when I was trying to do it, so I hope I'll help you with that. I didn't find out how to use the XPATH or QUERY_MATCH dispatchers on Weblogic (none of them worked) but since everything I wanted to do I was able to do through the SCRIPT dispatcher, I didn't bother to go further than that.

  4. Start MockService.
  5. Call MockService from Request to be sure the mock is working as expected.

  6. Stop MockService.
  7. Click with left mouse button on the project and select "Deploy As War".

  8. Fill in the fields as following:

  9. Select OK button.
  10. A war file and an open directory war will be created.
  11. Next step is to deploy the war file into Weblogic or directory generated by soapUI. I am assuming you already know how to do it.
  12. Access http://localhost:7001/soapui-example/webui.

    #3 - The logo image will not load. That's a problem with the path of the image on Weblogic but that doesn't prevent your mock from working.

  13. Verify if it's showing the mock's wsdl by clicking its link. For this example the link url was http://localhost:7001/soapui-example/mockExampleWS?WSDL.
  14. Add the deployed mock's wsdl to soapUI project. If it executes successfully it means the wsdl is valid.
  15. Add the deployed mock endpoint to the request in soapUI and execute it. For this example the endpoint was http://localhost:7001/soapui-example/mockExampleWS. If the web service returns the correct response it means your deployed mock is working correctly.

That's all. Hope I helped someone out there having the same problem. If you have any other tips regarding soapUI war and Weblogic, feel free to post a comment.


About the author

Maria Isabel Rodrigues is a Software Engineer and BPM Analyst (automation) at Decatron, Rio de Janeiro, Brazil.


By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox