Friday, 1 April 2016

How to use Java2WSDL and WSDL2Java ?


Java2WSDL

Java2WSDL command line will generate a standard WSDL file that conforms to a given interface.
Options
  • Name of output WSDL ( fib.wsdl )
  • URL of the Web service ( http: //localhost:8080/axis/services/fibonacci )
  • Target namespace for the WSDL; Package where service resides ( urn:fibonacci )
  • Map Java package = namespace; Java Package where service resides ( urn:fibonacci )
  • Fully qualified class itself; Main business class where operation is written. ( fibonacci.Fibonacci )

The full command for our example becomes something like : 
java org.apache.axis.wsdl.Java2WSDL -o fib.wsdl -l"http: //localhost:8080/axis/services/fibonacci" -n urn:fibonacci -p"fibonacci" urn:fibonacci fibonacci.Fibonacci


WSDL2Java

WSDL2Java generates the server-side wrapper code and stubs for easy client access.

Options
  • Base output directory ( . )
  • Scope of deployment ( Application, Request, or Session )
  • Turn on server-side generation
    We wouldn't do this if we were accessing an external Web service, as we would then just need the client stub
  • Package to place code ( fibonacci.ws )
  • Name of WSDL file ( fib.wsdl )

java org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -p fibonacci.ws fib.wsdl

No comments:

Post a Comment

Note: only a member of this blog may post a comment.