01 March 2010 - 3.5 user guide eclipse intellij netbeans maven download nightly forum bugs blog sf.net eviware


Eviware Logo

Publishing Web Services

Publishing a Web Service refers to the process of exposing an existing POJO or EJB as a Web Service, either using JSR-109/J2EE based artifacts or using JSR-181 annotations, the JBossWS plugin here acts as a wrapper around the JBossWS WSTools utility and related processes which are described in the JBossWS user guide.

Once the JBossWS Nature has been enabled for a project as described in the Getting Started document, you can right-click on a Java-class and select the "JBossWS - Publish as Web Service" option:

Setting Publish Options

The Basic tab has the following options:

  • Interface - the Java interface that is to be published, a list containing all interfaces implemented by the selected class will be shown
  • Service Name - a name for the service to be published
  • Style - if the service should be document or RPC style
  • Parameter Style - if the parameters should be wrapped or bare (only for Document style Web Services)
  • Deploy as - selects if the generated Web Service should be deployed as a POJO (using a servlet) or an EJB.
  • Servlet/EJB-link - depending on the "Deploy as" setting, this specifies the name of the link for the generated Servlet or EJB
  • Deployment Descriptor - should point either to a web.xml (for POJO's) or ejb-jar.xml (for EJB's). Generated descriptors will be merged into the specified file
  • Endpoint - the endpoint under which the Web Service should be accessible. Depends on the deployment and project type (will be automatically suggested/generated in a future version)

The Advanced tab has the following option:

  • Output WEB-INF Directory - target for generated configuration/mapping files. The JBossWS plugin will merge generated files into existing ones in this directory.
  • Package - name of a war package to create when publishing as POJO. This will use the packaging features available in JBossIDE to automatically create a war that can directly be deployed to a JBossWS installation
  • Mapping-file - the name of a JAX-RPC mapping file to create, relative to the output WEB-INF directory. If the file exists, generated mappings will be merged into the existing file.
  • Target NS - the target namespace for the generated WSDL, defaults to "urn:<package-name>"
  • Types NS - the namespace for the generated xml-schema types, defaults to "urn:<package-name>.types"
  • Mapping Override - a previously available jaxrpc-mapping file to use instead of the generated one. If specified, the file will be copied into the specified output WEB-INF directory and the generated entry in webservices.xml will use this file instead.
  • WSDL Override - a previously available WSDL file to use instead of the generated one. If specified, the file will be copies into the specified output WEB-INF directory and the generated entry in webservices.xml will use this file instead.
  • WSDL Port to Use - if overriding the WSDL, you need to specify which actual port in your WSDL that should be regarded as the one in use. This will be set in the webservices.xml file.
  • Import Interface - controls if the generated WSDL is to be imported/updated into the underlying JBossWS project node for testing, etc... Uncheck this option if you for example implementing a WSDL that has already been imported

Generating

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 last 2 rows in the above output show that the generated WSDL has been imported into the associated soapUI project; in the Project Explorer you can now expand the "JBossWS Web Services" node and browse the imported WSDLs operations or requests as "normally".

The generated mapping/configuration files are visible under the specified output directory. The plugin will in all cases try to merge created files with existing ones.

When running the above procedure (for example after adding a new method to the class that is being published), the WSDL will be updated and the corresponding soapUI project will be updated accordingly if the "Import Interface" option has been selected.

Deployment

When running the plugin under JBossIDE and specifying a deployment Package as described above, the JBossWS plugin will create a WAR file in the project root containing the current projects classes and WEB-INF directory. Deploy the file by right-clicking and select "Run As / Run on Server" and then selecting a configured JBoss server instance.

The package can be seen and modified under "Project Properties / Packaging Configurations".


Next: Consuming Web Services with JBossWS