Friday, November 16, 2012

Creating an opentravel SOAP client and server for testing using soapui

If you are creating a web services client or server in the Travel Industry, you are probably using the opentravel messaging schema.

Sometimes the most difficult part of your project is creating a test client or server to verify your application code.

soapui is a great open source utility for easily creating manual and automated SOAP test suites.

I'm going to show you how to quickly set up a SOAP test client and a SOAP test server for an opentravel message pair using soapui.

The first thing you will need is a WSDL file. Luckily the ota-tools project has many open source resources for opentravel users, including a soapui project with sample WSDL file that we can use as a template.

You can download this WSDL file from the ota-tools source repository at:

This WSDL is currently configured for the 2012A version of the Ping message pair. If you would like to use a different message pair, just change the import statements to point to your root schema.

For example, if I want to test the cancellation message pair, I would change:

<xsd:import namespace="http://www.opentravel.org/OTA/2003/05"
  schemaLocation="http://www.opentravel.org/2012A/OTA_PingRQ.xsd" />
<xsd:import namespace="http://www.opentravel.org/OTA/2003/05"
  schemaLocation="http://www.opentravel.org/2012A/OTA_PingRS.xsd" />
to:

<xsd:import namespace="http://www.opentravel.org/OTA/2003/05"
  schemaLocation="http://www.opentravel.org/2012A/OTA_CancelRQ.xsd" />
<xsd:import namespace="http://www.opentravel.org/OTA/2003/05"
  schemaLocation="http://www.opentravel.org/2012A/OTA_CancelRS.xsd" />

Then change the message root elements to match the root elements of the schema that you are testing. In this example, I would change:

<wsdl:message name="Request">
<wsdl:part element="ota:OTA_PingRQ" name="payload">
</wsdl:part>
</wsdl:message>
<wsdl:message name="Response">
<wsdl:part element="ota:OTA_PingRS" name="payload">
</wsdl:part>
</wsdl:message>
 
to:

<wsdl:message name="Request">
<wsdl:part element="ota:OTA_CancelRQ" name="payload">
</wsdl:part>
</wsdl:message>
<wsdl:message name="Response">
<wsdl:part element="ota:OTA_CancelRS" name="payload">
</wsdl:part>
</wsdl:message>

Now you are ready to create a test client and server in soapui.

From the soapui main menu, select, File -> New soapui Project

In the dialog box, click the browse button and open the wsdl file that you just edited:

Give your project and name and click 'OK'

Generate a default service

and give it a name:

Now you are ready to start your mock service. Click on the green 'Go' button in the upper left. Now your service is running and you can call it from soapui or the opentravel client that you are developing.

Now let's test our service. Open the sample request and,

press the green 'Go' button in the upper left. You should have a response message on your screen.
 VoilĂ !

Now you are ready to add some logic to your soapui test server and create a soapui client test suite. You will find a nice project with examples in the ota-tools soapui project.

This sample project is located in our source repository at:

Just download the opentravel-soapui-project.xml file and import it into soapui.

Now you're ready to test your opentravel client or server code!






10 comments:

iphone developers said...

thanks for sharing the post

Aadam Gibson said...

Great stuff. Thanks to post this kind of knowledgeable blog.

Innovapath said...

Excellent Post. Also visit http://whiteboxqa.com/#index.php

Verna J. Lacombe said...

This is a fantastic publish regarding android operating system development! Those who want to understand such will absolutely find these training useful and beneficial.Ecommerce Web Design

Anandmahalakshmi said...

great article. I would like to get support for PHP Integration as well. Can you give idea about it?

http://anandmahalakshmi.com

Steve Smith said...

Great and Useful Article.

Java Web Services Training

Java Web Services Training

Whizdom Trainings said...

hi,we provide online training & video tutorial for soapui
for free videos refer
http://soapui-tutorial.com/soapui-tutorial/introduction-to-webservices/

John Alert said...

Java Web Services Training in Chennai Java Web Services Training in Chennai Java Web Services Online Training Java Web Services Training in Chennai

John Alert said...

Java Training Institutes Java Training Institutes Core Java Training Institutes in Chennai
Java Spring Hibernate Training Institutes in Chennai Java Spring Hibernate Training Institutes in Chennai | Hibernate Training Institutes in Chennai J2EE Training Institutes in Chennai J2EE Training Institutes in Chennai

Divya madhuri said...

I have read your article its very nice attractive and impressive. I like it your article.Let me share useful information for CCNA jobs in Hyderabad