26 September 2007 - 1.7.6 | home user-guide eclipse jbossws intellij netbeans maven 1.X/2.X PDF files forums bugs sourceforge

Home
Getting Started
User Guide
IDE/Tool Plugins

- Maven Plugins
  - Maven 1.X Plugin
    - Goals
    - Properties
  - Maven 2.X Plugin
    - Goals
    - Properties
- NetBeans Plugin
  - Installation
  - Project Integration
- IntelliJ Plugin
- Eclipse Plugin
  - soapUI Nature
- JBossWS Plugin
  - New in 2.0.0 beta2
  - Getting Started
  - Publishing Web Services
    - Publish POJO Example
  - Consuming a Web Service
  - Implementing a Web Service
    - Implement WSDL Example
  - Web Service Annotations
    - EJB3/WS Annotate Example

Search soapUI site
Project Documentation

- About soapUI
- Project Info
- Project Reports

## Publishing POJO Web Service - Walkthrough Example

The following example gives a complete walkthrough of how to implement and deploy a Web Service with the JBossWS plugin. The development environment is as follows:

- The JBossIDE-2.0.0-beta2 release
- JBoss 4.0.4-GA with EJB3 profile
- JBossWS 1.0.3

Start by installing the above and setting the path to the wstools script as described in the Overview.

### Create the project

Create a standard empty java project;

Add a source folder for our java code:

Add a package for our classes:

### Create and Implement the Service Interface

Create a simple IHelloWorld interface:

    package jbosstest;

    import java.rmi.Remote;
    import java.rmi.RemoteException;

    public interface IHelloWorld extends Remote
    {
    	public String sayHello( String subject ) throws RemoteException;
    }

(JBossWS requires webservice classes to extend Remote and all webservice methods to throw RemoteException)

Implement the interface:

    package jbosstest;

    public class HelloWorld implements IHelloWorld
    {
    	public String sayHello(String subject)
    	{
    		return "Hello " + subject + "!";
    	}
    }

### Enabled the JBossWS Nature

Before we can use the plugin we need to enable the JBossWS Nature as described in Getting Started;

Once enabled, the project structure should be as follows (in the Project Explorer View):

### Run the Publish Feature

Now we can publish our Web Service; right-click on the HelloWorld class and select "JBossWS / Publish as Web Service", which will open the "Publish" dialog as described in Publishing Web Services:

Most settings can be left at their default; just set the style to "rpc" and then select the advanced tab;

Here just select the "HelloWorld.war" entry from Package drop-down. Now select the Generate button, which will start generation of the project:

After the generation has finished, packaging will be run which will be visible in another console window:

After these steps, the project state should now be as follows:

### Deploy Locally

Now all that is left is to deploy the generated WAR-file to our local JBoss server; right-click the generated HelloWorld.war file and select "Run as / Run on Server" and then select your locally configured and running JBoss installation. You should get a deployment log in the servers console:

### Test

Double-click the previously generated "Request 1" entry under the "sayHello" node in the Project Explorer, this will open a SOAP request editor:

Change the '?' to 'Marc', save the request (CTRL-S) and press the green arrow in the toolbar for sending the request to the local Web Service. You will get the response in a new editor tab:

Next: Consuming a Web Service