soapUI tutorial for Eclipse

webservicesIn this tutorial we will show how to deploy and test your Web Services on JBoss application server using soapUI plugin.


soapUI is a free and open source cross-platform Functional Testing solution. With an easy-to-use graphical interface, and enterprise-class features, soapUI allows you to easily and rapidly create and execute automated functional, regression, compliance, and load tests.

soapUI is available in the pro edition or in the opensource edition. The pro edition offers some more advanced features like data-driven testing, powerful reporting, and technical support. In this tutorial we will however show how to integrate the opensource edition with Eclipse IDE.

Install soapUI plugin

An eclipse update site is now available at http://www.soapui.org/eclipse/update, install the soapui-eclipse-plugin by choosing in the Menu Help > Install New Software. Now add the the above location and install the plugin. Eclipse will need restarting before using the plugin.
soapUI tutorial eclipse web services

Deploying a sample Web service


In order to start testing Web services we will deploy a very simple Web service on JBoss AS.

package com.sample;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public class MathService {
@WebMethod()
   public int sum(@WebParam(name="number1")int x, @WebParam(name="number2") int y) {
       return (x+y);
   }
}


By deploying your Web service you see on the server logs the publish address:

09:06:48,570 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean]
 (MSC service thread 1-7) Creating Service {http://sample.com/}MathServiceService from class com.sample.MathService
09:06:48,640 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-7)
 Setting the server's publish address to be http://localhost:8080/HelloWebService/MathService

Now it's time to test the Web service using soapUI.

 

Using the soapUI perspective

Open the soapUI Perspective by using the standard Window/Open Perspective/Other... Command and selecting "soapUI" from the list. The perspective will open 2 views;

  • A "soapUI Navigator" view to the left containing the same Navigator and Details tab as the standalone soapUI version.
  • A "soapUI Logs" view to the bottom containing the same log tabs as the standalone soapUI version.


Now within the soapUI Navigator right-click on your project and choose a "New soapUI Project"

Fill up the next dialog with the WSDL information, which is available on JBoss AS server:
soapUI tutorial eclipse web services jboss
You will see that the project will automatically discover the operations exposed by the Web service.
soapUI tutorial eclipse web services jboss
Double click on the Request1 tree  element: the soapUI Request Perspective will appear where you can fill up the named parameters:

soapUI tutorial eclipse web services jboss

In the corresponding Response Window you will check the result of your Web service invocation:

soapUI tutorial eclipse web services jboss

The soapUI eclipse plugin provides full soapUI functionality from within Eclipse. Check out on the Home page (http://www.soapui.org/IDE-Plugins/eclipse-plugin.html) for more information about it.

Related articles available on mastertheboss.com

JBoss web services

JAX-WS simplifies the development model for a web service endpoin

What is a Web Service One Way invocation?

JBoss recipe of the day

Asynchronous web services with JBoss WS

Developing rigorous and responsive web service client application

How to change the default Web Service deployment Port ?

JBoss recipe of the day

Using Axis Web Services with JBoss

Still not ready for JBoss WS ? if you don't have a JDK 1.5 compli

Invoking JBoss Web Services with Flex

Flex® is a free, open source framework for building highly in

Follow us on Twitter