06 August 2007 - 1.7.5 | 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

## Implementing Web Services

Implementing or consuming a Web Service refers to the process of starting with an existing WSDL contract and then creating the java classes that either fulfill or consume this contract. The WSDL can either be remotely available over http or a local file in the current project. In either case, the process consists of 4 steps:

1. Adding the WSDL to the "JBossWS Web Services" node
2. Generating a server-side interfaces classes for implementating the contract
3. Implementing the generated interfaces
4. Publishing the implemented interface as a Web Service, optionally using the original WSDL and mapping file

Step 1 and 2 above are the same as described under Consuming Web Services, please refer to that document for these. Be sure to generate the required JAX-RPC mapping file as it is reused in the publish process.

### Implementing the interface

When generating artifacts as described under Consuming Web Services, a java Interface will be generated corresponding to the imported interface. For example when generating for the freely available CurrencyConverter available at http://www.webservicex.net/CurrencyConvertor.asmx?WSDL, the following interface is generated for the services SOAP Binding:

    /*
     * JBossWS WS-Tools Generated Source
     *
     * Generation Date: Sat Sep 30 15:27:28 CEST 2006
     *
     * This generated source code represents a derivative work of the input to
     * the generator that produced it. Consult the input for the copyright and
     * terms of use that apply to this source code.
     */
    package test;

    public interface CurrencyConvertorSoap extends java.rmi.Remote {

    	public test.ConversionRateResponse conversionRate(
    			test.ConversionRate conversionRate) throws java.rmi.RemoteException;
    }

Now implement this interface in a java class:

    package test.impl;

    import java.rmi.RemoteException;

    import test.ConversionRate;
    import test.ConversionRateResponse;
    import test.CurrencyConvertorSoap;

    public class CurrencyConverterSoapImpl implements CurrencyConvertorSoap {

    	public ConversionRateResponse conversionRate(ConversionRate conversionRate)
    			throws RemoteException {
    		return new ConversionRateResponse(0.0);
    	}
    }

### Publishing the implementation

Once implemented, publish the Web Service as described in the Publish document. Since you have already generated a mapping file during the "consume" process and the WSDL is publically available, you should specify to reuse the created mapping file and uncheck the option to import the WSDL into the JBossWS Project:

If you have the WSDL locally, you can select to use it instead and must also specify the wsdl port to use.

Next: Generating Web Service Annotations