Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Swordfish Documentation: Creating JAX-WS Client

Creating the JAX-WS Client

This section contains instructions on creating the JAX-WS client for the JAX-WS service deployed into the NMR.

Prerequisites

Eclipse Galileo (Eclipse 3.5) build or later. The examples described here are based on Eclipse 3.5.
The target platform should contain the Apache CXF and the org.eclipse.swordfish.plugins.cxf.support bundles

About JAX-WS Client

For general information on how to configure the JAX-WS client, see Configuring a Spring Client section.
It is used to create the Java proxy based on the supplied interface class.
This proxy transforms the method call into the SOAP request and sends it to the Web service

Creating the Client

The sample that shows how to create the JAX-WS client is located at http://dev.eclipse.org/svnroot/soa/org.eclipse.swordfish/trunk/rt/org.eclipse.swordfish.samples.bookingservice/

To create the client:

  1. Create the spring XML configuration file
  2. Add the following spring imports:
        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/org/eclipse/swordfish/plugins/cxf/support/nmr-transport.xml" />
       
    
  3. Add the JAX-WS client entry:
     <jaxws:client id="<<The name of the client>>"
                      serviceClass="<<The interface class of the web service deployed>>"
                      serviceName="<<The serviceName QName (service element in the wsdl)>>"
                      address="nmr:<<The name of the webservice's nmr endpoint>>" />
    

    serviceName attribute is optional
    For example, for the JAX-WS endpoint:

     <jaxws:endpoint id="bookingService"
    	                implementor="org.eclipse.swordfish.samples.cxf.BookingServiceImpl"
    	                address="nmr:BookingService"/> 
    

    The client should look like this:
     xmlns:swordfishCxf="http://cxf.samples.swordfish.eclipse.org/"
     ....
    <jaxws:client id="bookingServiceClient"
                      serviceClass="org.eclipse.swordfish.samples.cxf.BookingService"
                      serviceName="swordfishCxf:BookingServiceImpl"
                      address="nmr:bookingService" />
    
  4. Provide the necessary ImportPackage and Require-Bundle statements in the MANIFEST.MF file as done in the http://dev.eclipse.org/svnroot/soa/org.eclipse.swordfish/trunk/rt/org.eclipse.swordfish.samples.bookingservice/META-INF/MANIFEST.MF.


Running JAX-WS Client

In order to execute JAX-WS client you need to run the bundle containing the client within the Swordfish Target platform.

For more information about how to run Target Platform, see Running the Target Platform.


Swordfish Documentation Home
Swordfish Wiki Home

Back to the top