O'Reilly logo

Java and SOAP by Robert Englander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9.4. Calling an Apache SOAP Service from a GLUE Client

This time, we'll write a GLUE client that accesses the urn:QuoteProxyService we just created. But how do we begin? GLUE creates service bindings dynamically based on a WSDL document. In our GLUE-to-GLUE examples, GLUE automatically generated the WSDL document describing the service, but Apache SOAP doesn't do that. We could certainly write an appropriate WSDL document by hand . . . but that's a lot of work, and the chances of ending up with a WSDL document that's correct are fairly small, unless you want to learn a lot more about WSDL than anyone should have to know. Instead, we'll use the java2wsdl tool that comes with GLUE to generate the WSDL.[4] This tool doesn't care that the Java code isn't for a GLUE-based service; it simply reads the Java code and generates the WSDL. java2wsdl doesn't give us a perfect WSDL document for the Apache-based service, but it's much less work to modify the document by hand than it is to write the whole thing. So let's generate the WSDL:

[4] Other tools for this purpose are available from other sources. For example, the IBM web services toolkit includes a similar utility.

java2wsdl javasoap.book.ch9.services.QuoteProxyService -n 
    urn:QuoteProxyService -t urn:QuoteProxyService -s 
    -e http://georgetown:8080/soap/servlet/rpcrouter

The first parameter to java2wsdl is the Java class that implements the service. The -n option allows us to specify the namespace; we'll use the name of the service ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required