Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • @WebService- This annotation can be used with a Java class as well as with interface. In our case we used it with both interface as well as the POJO. This annotation declares the POJO as a WebService. @WebService annotation is utilized in generating the WSDL file.
    • serviceName is same as the WSDL element service
    • name is same as the WSDL element <portType name>
    • endpointInterface suggests the user defined name for the Service Endpoint Interface (SEI).
    • portName is the element portName
    • targetNamespace is the XML namespace of the WSDL and some of the XML elements generated from the WebService
  • @WebMethod- This annotation is applied to a method to expose it as a WebService method. In case you have multiple methods you can use this annotation to selectively expose methods as WebService method. If you donot use this annotation all the public methods will be exposed as WebService.
  • @WebParam- This annotation is used along with @WebMethod annotation to define the WebService. It is used to customize parameter used in the message part of the wsdlWSDL.

This completes the development of the Web Service Implementation code.

Generating the

...

WSDL for the

...

Web Service

Geronimo provides a new jaxws-tools.bat which helps in generating the WSDL file from service endpoint interface.

  • Export the source files to a jar as shown in the following three figures:










  • Open a command prompt and point it to the bin directory of server installation:

    1. *# Run the command
      Code Block
      titleWSDL Generation command
      borderStylesolid
      Administrator@T60J9:/> jaxws-tools.bat -classpath C:/WSDL/source.jar -d C:/WSDL/ -wsdl:soap1.1 org.apache.geronimo.samples.jws.CalculatorService
      
      In this command -classpath is used to set the source.jar exported from Eclipse in the classpath, -d defines the location where all the generated artifacts will be placed, -wsdl:soap1.1 suggests a WSDL generation following soap1.1 protocol, and org.apache.geronimo.samples.jws.CalculatorService is the SEI used to generate the WSDL.
    2. Once the above command is run Calculator_schema1.xsd and Calculator.wsdl will be generated at C:/wsdlWSDL/.

    3. Rename Calculator.wsdl as CalculatorService.wsdl and add both the generated files to WEB-INF directory of the project.

...