WSIT with a Java SE endpoint

The JAX-WS RI is supporting an Endpoint API that allows you to implement a web service just in plain Java without the need for a Servlet or EJB container. While we don't explicitly test WSIT with this API, it is still working just fine with it. You just need to take into account a few caveats.

Here is some sample web service code. It does not differ in any way from any other JAX-WS web service:

import javax.jws.WebService;

@WebService
public class MyService {

public String hello(final String text) {
return text;
}

}

Since you don't have a container, you will need to write a little bit of code to start a server that can host the web service. This code is ripped right off the Endpoint API documentation:

import javax.xml.ws.Endpoint;

public class Main {

private static final int PORT = 58888;

public static void main(String[] args) {
Endpoint endpoint = Endpoint.create(new MyService());
endpoint.publish("http://localhost:" + PORT + "/");
}
}

You will still need to generate the portable artifacts of your web service before you run it. See the JAX-WS RI User Guide for details.

So far all we have is an ordinary JAX-WS web service. If you are running Java 6, please remember that you need to put the API library into an endorsed directory, otherwise the JAX-WS 2.0 APIs included in Java 6 will override the JAX-WS 2.1 APIs that we require. Put webservices-api.jar into an endorsed directory if you are running Java 6. At runtime you will need webservices-rt.jar and webservices-extra.jar on the classpath and to generate the portable artifacts you need webservices-tools.jar.

So, this was still all plain JAX-WS. All that you need to do to unleash WSIT is provide a configuration file and put it into the META-INF directory of your JAR (or if you have not jared up your code yet, put it in a META-INF directory on your classpath.) Writing a correct configuration file manually is an unpleasant task. I strongly recommend that you use NetBeans to generate one for you and then copy it into your project. The WSIT tutorial has extensive documentation on how to generate a configuration file.

Technorati:

Comments:

[Trackback] Fabian explained how WSIT features can be configured on Java SE 6 Endpoint API exposed as part of JAX-WS 2.1. In this blog, I start with a Reliable Messaging-enabled endpoint developed using NetBeans IDE 5.5.1 and WSIT plug-in and then...

Posted by Arun Gupta's Blog on June 18, 2007 at 08:29 PM EEST #

[Trackback] The GlassFish V2 Web services stack consists of JAX-WS as the core platform and Project Tango (aka Web Services Interoperability Technology, WSIT) as an implementation of key WS-\* specifications on top of it. This stack, so far referred as "JAX-WS...

Posted by Arun Gupta's Blog on June 19, 2007 at 02:37 PM EEST #

Post a Comment:
Comments are closed for this entry.
About

ritzmann

Search

Categories
Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today