Thursday, January 07, 2010

Creating an OpenTravel Server

Here are step-by-step instructions for setting up a server to process messages from the OpenTravel project.

In this tutorial you will create a module to service the OpenTravel "Ping Request".

Prerequisites:
  1. Download my (tiny) opentravel-webservice framework from the OpenTravel tools project and unzip it. There are several other open source tools in this project that you may want to look at... or contribute to!
  2. Make sure the Java sdk is installed.
  3. Install Apache Maven. This program auto-installs all the build tools and libraries that you will need. Make sure mvn is in your path.
  4. Install a osgi server. I prefer the fuse distribution of Apache Servicemix. Almost all web servers can handle osgi modules, but servicemix has some cool capabilities and tutorials (I based this tutorial on their getting started tutorial).
  5. Install soapui (Optional - If you prefer another web services client, use it). You may have also noticed there is a soaui test framework on the OpenTravel Tools site.
Now you're ready to get started!
  1. Build and Package the webservices modules:
    > cd {your path}/opentravel-webservice
    > mvn install
    (This may take a while the first time you run it. Ignore the warnings)
  2. Install the web service module and the soap interface to your web server:
    > cd {your path}/apache-servicemix-{4.1+ version}
    > bin/servicemix
    karaf@root> features:install cxf-osgi
    (Make sure the apache open source services framework is installed)
    karaf@root> osgi:install -s mvn:org.apache.servicemix.cxf/org.apache.servicemix.cxf.transport.osgi/4.2.0-fuse-SNAPSHOT
    (Install the apache http osgi transport)
    karaf@root> osgi:install -s mvn:org.opentravel/opentravel-webservice-se
    (Install the opentravel web service module that you just built)
    karaf@root> osgi:install -s mvn:org.opentravel/opentravel-webservice-bc
    (Install the opentravel web service soap binding module that you just built)
  3. Test it! Check out the response when I sent this Ping Message using soapui (in a new shell):
    > cd {your path}/soapui
  4. > chmod a+x bin/soapui.sh
  5. (Only do this the first time)
  6. > bin/soapui

  7. File -> New WSDL Project
    The url for your WSDL file is: http://localhost:9090/cxf/openTravelService?WSDL


Now try sending a message. Open the tree openTravelBinding -> PingIncommingRequest -> Request and Paste in this simple ping message:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.opentravel.org/OTA/2003/05">
<soapenv:Header/>
<soapenv:Body>
<ns:OTA_PingRQ Target="Production" Version="1.005">
<ns:EchoData>Hello</ns:EchoData>
</ns:OTA_PingRQ>
</soapenv:Body>
</soapenv:Envelope>

Voilà, You've been pinged!





Now you're probably asking yourself if this really creates valid message. Well, let's test it. The ota-tools project has a great test sub-project called ota-soapui. Just open the project in soapui and change the endpoint destination of the four test cases to http://localhost:9090/cxf/openTravelService


Now open the test suite and hit the run button. Cool, all the tests are successful!


This project is a great starting point for your OpenTravel implementation or test project.

Please leave a comment if would like more blogs on this subject... or if you have any questions or recommendations!

19 comments:

Michael Brasil said...

Hi Don, I am in the middle of trying out your OTA ping service. I get following error when trying to install the OTA webservice bc and se. See karaf@root> osgi:install -s mvn:org.opentravel/opentravel-webservice-bc
java.lang.RuntimeException: URL [mvn:org.opentravel/opentravel-webservice-bc] could not be resolved. Till that step everything worked fine. I keep you informed
Thanks
Michael

Michael Brasil said...

Solved, I was too fast. I should have let the "mvn install" process finish before I try to install it in ServiceMix ;-)

Unknown said...

Michael,
If you haven't run maven before, downloading all the dependencies can take some time.
Glad to hear you were successful!

panelselsurya said...

Thank you for your enlighten. I had installed it and it work. However I need to change it from localhost:9090 to have it connect from remote machine. Can you please inform me?

anurag said...

Hi Don,

I was following your steps and ran into error below :
4.2.0-fuse-SNAPSHOT could not be resolved
in my maven repository :

C:\Users\anurag\.m2\repository\org\apache\servicemix\

there is no sub-dir as cxf?

I am using apache-servicemix-4.3.0-fuse-00-00

can you guide me..what changes do i have to make to get it working :

below is the error :

karaf@root> features:install cxf-osgi
karaf@root> osgi:install -s mvn:org.apache.servicemix.cxf/org.apache.servicemix.
cxf.transport.osgi/4.2.0-fuse-SNAPSHOT
java.lang.RuntimeException: URL [mvn:org.apache.servicemix.cxf/org.apache.servic
emix.cxf.transport.osgi/4.2.0-fuse-SNAPSHOT] could not be resolved.
karaf@root>

Thanks

Dheerubhai said...
This comment has been removed by the author.
Dheerubhai said...

Hello Don,
In your project there is opentravel-webservice-bc\src\main\resources\wsdl\openTravelService.wsdl file.


May I know, How did u create this openTravelService.wsdl file? Is it written manualy?

Unknown said...

Dheerubhai,
Yes I created the wsdl manually. This is an example of wsdl first development. As complicated as the wsdl looks, most of it is boilerplate code. Only a small portion of this wsdl is specific to this application.
Don

Anonymous said...

hi,

How do i get Data using php Soapclient, it send me an error:
Fatal error: SOAP-ERROR: Parsing Schema: can't import schema from 'https://xmlprosdk.wspan.com/msgdoc/wsdl/OTA_AirFlifoRS.xsd'

Kingly help me.

Unknown said...

Unknown,
This is a very simple fix. You should not have changed the web addresses of the opentravel urls in your wsdl file. Change the wsdl in your project that references https://xmlprosdk.wspan.com/msgdoc/wsdl/OTA_AirFlifoRS.xsd to http://www.opentravel.org/2011B/OTA_AirFlifoRS.xsd and everthing will work fine.
Don

Unknown said...

Unknown,
Specifically, the error you are getting is due to the fact that you modified the OTA_AirFlifoRS.xsd and removed the 'include' element. There is no way for the php xml parser to find the referenced types. Again, just reference the on-line versions of the schema and it will work.
Don

jim smith said...

Glad to hear you were successful!
Transmission Repair in Hollywood FL

Unknown said...

Hi, I need to import the ota wsdl in .Net via visual studio wsld generation tools. Is any body familiar with ota in .Net?
Where can I find the ota wsdl? I've only the xsd schemmas.

for ict 99 said...

Java Web Services Online Training | Web Services Course | Web Services Training Courses | Java Web Services Training in Chennai | Java Course in Chennai | Java Training Institutes in Chennai | Java Training in Chennai

norhan said...

نجار ابواب بالرياض نجار ابواب بالرياض
تركيب ستائر بالرياض افضل شركة تركيب ستائر بالرياض
تنظيف مكيفات بالرياض شركة غسيل مكيفات بالرياض
شركة تنظيف افران الغاز بالرياض تنظيف افران بالرياض


Marry07 said...

If you are looking for a job oriented practical based workday course syllabus curriculum at Workday training institutes in India then you are arrived at the right place called Workday training institutes in ameerpet because this institute is quite popular for this wonderful course not just in Workday training institutes in Jaipur and also proving job assistance for Workday training institutes in Pune

Austin said...

You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. Salesforce Training India   

Anitha said...

This article is really helpful for me. I am regular visitor to this blog. Share such kind of article more in future. Personally i like this article a lot and you can have a look at my services also: I was seriously search for a Salesforce training institutes in ameerpet which offer job assistance and Salesforce training institutes in Hyderabad who are providing certification material. It's worth to join Salesforce training institutes in India because of their real time projects material and 24x7 support from customer desk. You can easily find the best Salesforce training institutes in kukatpally kphb which are also a part of Pega training institutes in hyderabad. This is amazing to join Data science training institutes in ameerpet who are quire popular with Selenium training institutes in ameerpet and trending coureses like Java training institutes in ameerpet and data science related programming coures python training institutes in ameerpet If you want HCM course then this workday training institutes in ameerpet is best for you to get job on workday.

Varsha Audichya said...

Thanks for sharing this article. This article is really helpful for everything.https://seo-ppc-experts.com