06 August 2007 - 1.7.5 home user-guide eclipse jbossws intellij netbeans maven 1.X/2.X PDF files forums bugs sourceforge






Consuming Web Services

Consuming an existing Web Service boils down to creating client side artifacts and then creating instances for invoking the remote service, the process consists of 2 steps:

  1. Adding the external WSDL to the "JBossWS Web Services" node
  2. Generating a client side classes for invoking the service

Adding the WSDL

Add the WSDL to the JBossWS Web Services node by selecting the "JBossWS - Add WSDL from URL" option:

This will prompt for a WSDL and import it accordingly into the project

If the WSDL resides locally in the file system it can be added using the corresponding "JBossWS - Add WSDL from File" option. If it is part of the current project, it can be added by selecting the "JBossWS - Add to JBossWS Project" option from the WSDL's right-button menu:

Generating artifacts

Once the WSDL has been imported, select the "Generate - JBossWS artifacts" option from its right-button menu:

This will open a dialog with the following options:
  • Use Cached WSDL - the plugin caches the WSDL internally when it is added to the project (this can be switched off in the global preferences..). Uncheck this option if you want to generate from the original WSDL location.
  • Mapping file - the name of a JAX-RPC mapping file to generate for the WSDL (required!)
  • Unwrap - unwraps doc-literal operations
  • Namespace Mapping - a table containing all namespaces defined in the imported WSDL, you must specify a destination package for esach namespace.

Once all options have been set as required, select the "Generate" button at the bottom of the dialog which will invoke the WSTools utility as configured. The output will be shown in the console view:

The generated files will be placed in the folder specified under project properties. Currently, the JBossWS plugin lacks support for automatically adding service-refs to compontents that are to consume the service, this must be performed manually as described in the JBossWS User Guide


Next: Implementing a Web Service