Exforsys

Home arrow Reviews arrow Java SOA Training

Deploy the Web Service

Author : Exforsys Inc.     Published on: 20th Jun 2008

Deploy the Web Service

As a first step, if you haven't done it before, edit examples.PROPERTIES (provided along with the code download for this chapter), and change the paths there to match your development environment. The code download for this chapter also includes a README.txt file, which gives detailed steps to build and run the samples.

Ads

We have a simple web service in the codebase present in the folder
ch10\ServiceMixHttpBinding\01_ws. To deploy the web service, first change directory to the ch10\ServiceMixHttpBinding folder and execute the ant command as follows:

cd ch10\ServiceMixHttpBinding
ant

In fact, the build.xml file will call the build in the subprojects to build the web service as well as the ServiceMix subproject.

The web service is built completely and the war file can be found in the folder
ch10\ServiceMixHttpBinding\01_ws\dist\AxisEndToEnd.war. To deploy the web service, drop this war file into your favorite web server's webapps folder and restart the web server, if necessary.

Now to make sure that your web service deployment works fine, we have provided a web service test client. To invoke the test client, execute the following commands:

cd ch10\ServiceMixHttpBinding\01_ws
ant run

We can also check the web service deployment by accessing the WSDL from the URL:

http://localhost:8080/AxisEndToEnd/services/HelloWebService?WSDL

Let us list out the WSDL here, since we want to compare it with the WSDL accessed from the ServiceMix binding later to cross check the similarities. This is provided in

    ch10\ServiceMixHttpBinding\HelloWebService-axis.wsdl

Sample Code
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <wsdl:definitions targetNamespace="http://AxisEndToEnd.axis.
  3. apache.binildas.com"
  4. xmlns:apachesoap="http://xml.apache.org/xml-soap"
  5. xmlns:impl="http://AxisEndToEnd.axis.apache.
  6. binildas.com"
  7. xmlns:intf="http://AxisEndToEnd.axis.apache.
  8. binildas.com"
  9. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  10. xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/
  11. soap/"
  12. xmlns:xsd="http://www.w3.org/2001/XMLSchema" target="_blank" rel="nofollow">
  13. <wsdl:types>
  14. <schema elementFormDefault="qualified"
  15. targetNamespace="http://AxisEndToEnd.axis.apache.
  16. binildas.com"
  17. xmlns="http://www.w3.org/2001/XMLSchema" target="_blank" rel="nofollow">
  18. <element name="hello">
  19. <complexType>
  20. <sequence>
  21. <element name="in0" type="xsd:string"/>
  22. </sequence>
  23. </complexType>
  24. </element>
  25. <element name="helloResponse">
  26. <complexType>
  27. <sequence>
  28. <element name="helloReturn" type="xsd:string"/>
  29. </sequence>
  30. </complexType>
  31. </element>
  32. </schema>
  33. </wsdl:types>
  34. <wsdl:message name="helloRequest">
  35. <wsdl:part element="impl:hello" name="parameters"/>
  36. </wsdl:message>
  37. <wsdl:message name="helloResponse">
  38. <wsdl:part element="impl:helloResponse" name="parameters"/>
  39. </wsdl:message>
  40. <wsdl:portType name="IHelloWeb">
  41. <wsdl:operation name="hello">
  42. <wsdl:input message="impl:helloRequest"
  43. name="helloRequest"/>
  44. <wsdl:output message="impl:helloResponse"
  45. name="helloResponse"/>
  46. </wsdl:operation>
  47. </wsdl:portType>
  48. <wsdl:binding name="HelloWebServiceSoapBinding"
  49. type="impl:IHelloWeb">
  50. <wsdlsoap:binding style="document" transport="http://schemas.
  51. xmlsoap.org/soap/http"/>
  52. <wsdl:operation name="hello">
  53. <wsdlsoap:operation soapAction=""/>
  54. <wsdl:input name="helloRequest">
  55. <wsdlsoap:body use="literal"/>
  56. </wsdl:input>
  57. <wsdl:output name="helloResponse">
  58. <wsdlsoap:body use="literal"/>
  59. </wsdl:output>
  60. </wsdl:operation>
  61. </wsdl:binding>
  62. <wsdl:service name="IHelloWebService">
  63. <wsdl:port binding="impl:HelloWebServiceSoapBinding"
  64. name="HelloWebService">
  65. <wsdlsoap:address location="http://localhost:8080/
  66. AxisEndToEnd/services/HelloWebService"/>
  67. </wsdl:port>
  68. </wsdl:service>
  69. </wsdl:definitions>
Copyright exforsys.com


Ads



 
This tutorial is part of a Java SOA Training tutorial series. Read it from the beginning and learn yourself.

Java SOA Training

 

Comments