Web Services Test Framework

This schema library includes a simple server framework for SOAP and RESTful web services.

The server framework contains utility methods to receive SOAP and RESTful messages, test the requests for validity and send a reply.

Included in the server framework are utilities to manipulate and check namespace aware XML schema. You can easily convert your JiBX object tree to XML or DOM. You can convert your XML using XSL Transformation. You can also search your XML trees using XPATH.

Having all these tools available make the server library the perfect toolbox to create your server test cases. The server library also has a utility that can read XML message files from the local classpath storage and use these messages as replies.

For more detailed example, check out my blog here.

Web service example

In this example you will install a simple web service that uses SOAP and REST protocols. This web service implements the opentravel.org hotel res service. When you send a HotelRes request this service echos a HotelRes reply

The project source code for this example is in our repository here: https://github.com/jibx/schema-library/tree/master/org.opentravel/_2012B/opentravel-ws/opentravel-hotel-ws-test-service.

This example uses three services:

  • Your hotel res service implementation which is registered as an OSGi service.
  • A hotel RESTful service that will call your OSGi registered hotel res service.
  • A hotel SOAP service that also uses your hotel res service.

Running this example

Step 1: Download Apache karaf and start it up.

 tar zxvf apache-karaf-x.x.x.tar.gz
 cd apache-karaf-x.x.x
 bin/karaf

Step 2: Add and run the JiBX OSGi bundles in this example.

 features:install obr
 obr:addurl http://www.jibx.org/repository/repository.xml
 obr:start -d org.jibx.schema.org.opentravel._2012B.hotel.ws.test.service
 obr:start -d org.jibx.schema.org.opentravel._2012B.hotel.ws.rest
 obr:start -d org.jibx.schema.org.opentravel._2012B.hotel.ws.soap

Step 3: You will find the wsdl file here: http://localhost:8092/soap/hotel?wsdl.

If you would like to test this web service to see if it works, either fire up soapui and send it a message or create a JiBX test client using the JiBX client framework.

You will find the RESTful web services located at http://localhost:8092/rest/hotel/function, where function is the action such as search, res, resmodify, etc.

Voilà