Tango on JavaSE 6

Guest Author

how WSIT features can be
configured on Java SE 6
exposed as part of JAX-WS
. In this blog, I start with a Reliable Messaging-enabled endpoint
developed using NetBeans IDE 5.5.1 and
WSIT plug-in and then provide
detailed steps, along with code, to deploy it in Java SE 6.

  1. Create a Reliable Web service endpoint using WSIT plug-in and NetBeans

    5.5.1 by watching

    this screencast

  2. Download and install

    WSIT Milestone 5
    . Copy webservices-api.jar in Java SE 6 'jre\\lib\\endorsed


  3. All the capabilities enabled at an endpoint, such as Reliable Messaging

    for this one, are stored in the WSIT configuration file. In NetBeans IDE,

    expand your Project, 'Web Pages, 'WEB-INF. The

    configuration file be named something similar to 'wsit-server.HelloWebService.xml

    following the format 'wsit-<packageName>.<ServiceName>.xml.

    Here is how the config file looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="HelloWebServiceService"
    <message name="sayHello"/>
    <message name="sayHelloResponse"/>
    <portType name="HelloWebService">
    <wsdl:operation name="sayHello">
    <wsdl:input message="tns:sayHello"/>
    <wsdl:output message="tns:sayHelloResponse"/>
    <binding name="HelloWebServicePortBinding" type="tns:HelloWebService">
    <wsp:PolicyReference URI="#HelloWebServicePortBindingPolicy"/>
    <wsdl:operation name="sayHello">
    <service name="HelloWebServiceService">
    <wsdl:port name="HelloWebServicePort" binding="tns:HelloWebServicePortBinding"/>
    <wsp:Policy wsu:Id="HelloWebServicePortBindingPolicy">
    <wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/>

    Copy this config file by the name wsit-server.HelloWebService.xml in META-INF directory in your classpath.
  4. The Web service implementation class looks like:
    package server;

    import javax.jws.\*;

    public class HelloWebService {
        public String hello(@WebParam(name="name")String text) {
            return "Hello " + text;


    As you see, this is a plain JAX-WS Web service endpoint class.

  5. The JAX-WS Endpoint code that starts the Web service endpoint looks like:
    package server;
    import java.io.IOException;
    import javax.xml.ws.Endpoint;
    public class Main {
       private static final int PORT = 58888;
       private static final String HOST = "localhost";
       public static void main(String[] args) {
            Endpoint endpoint = Endpoint.create(new HelloWebService());
            String address = "http://" + HOST + ":" + PORT + "/";
            System.out.println("Endpoint hosted at ... " + address);

  6. The sequence of commands to deploy the endpoint is:

    "\\Program Files\\Java\\jdk1.6.0_01\\bin\\javac.exe" -d . server\\\*.java
    "\\Program Files\\Java\\jdk1.6.0_01\\bin\\wsgen.exe" -cp . server.HelloWebService
    java -classpath .;\\jax-ws-latest-wsit\\lib\\webservices-rt.jar server.Main

  7. And then you see the following output on the command prompt:

    java -classpath .;C:\\testbed\\jax-ws-latest-wsit\\lib\\webservices-rt.jar server.Main
    Jun 18, 2007 4:46:34 PM [com.sun.xml.ws.policy.jaxws.PolicyConfigParser] parse
    INFO: WSP1049: Loaded WSIT configuration from file:

    Jun 18, 2007 4:46:34 PM [com.sun.xml.ws.tx.common.TxMapUpdateProvider] update
    INFO: WSTX-COMMON-2005: running in a non Java EE container; disable mapping of Container
    Managed Transaction EJB to WS-AT Policy assertions due to 'javax/ejb/TransactionManagement'
    Endpoint hosted at ... http://localhost:58888/

That's it, the endpoint now deployed at 'http://localhost:58888/MyService?wsdl
is Reliable Messaging enabled. This endpoint can be invoked using any of the

shown here



Join the discussion

Comments ( 9 )
  • Pat Patterson Monday, June 18, 2007
    Good stuff! Some smileys in the listings, though - I think you need to turn off a plugin...
  • Arun Tuesday, June 19, 2007
    Thanks Pat for the comment! I thought those smileys were cute :) But to be meaningful and listening to my readers, turned off the plugin.
  • saikrishna Friday, November 2, 2007

    Awesome stuff.. very helpful. Can you give me the code how to write for login page using web service in java. It would be helpful. thank you

  • Arun Gupta Sunday, November 4, 2007

    saikrishna, The code will be no different that invoking any other Web service. You just need to make sure your client-side artifacts are bundled in the WAR file though.

  • Rickard Lundin Wednesday, February 13, 2008

    Great example!

    I need to be able "runtime" to choose wsit config file. One way would be to have multiple "WEB-INF/..xml" and add exactly one of them to the jvm classpath.

    A dream scenario would be if I could do this programmatically at startup, like WSITEnginde.setConfig("mywsit.xml"). It might be possible when looking at the PolicyConfigParser.java ..

  • Fabian Ritzmann Thursday, February 14, 2008

    Rickard, it would be easier to discuss your scenario on the mailing list users@metro.dev.java.net: https://metro.dev.java.net/servlets/ProjectMailingListList

    You are having at least two options, both of which are a bit lengthy to explain. I am working on a blog entry right now and will have that ready and published by Monday at the latest. I will keep you posted.

    Tjenare, Fabian

  • Fabian Ritzmann Monday, February 18, 2008

    Rickard, I am discussing the options you are having here: http://blogs.sun.com/ritzmann/entry/non_standard_wsit_configuration_file

  • Ali Friday, April 18, 2008



    Hi, I have a problem of accessing web service methods, I have user name and password and I am using netbeans 6 but I don't know how to use them. I developing web service client. Server have been developed by other programmer they just given me wsdl file only.

    I always I get this kind of exception

    javax.xml.ws.soap.SOAPFaultException: WSDoAllReceiver: Request does not contain required Security header

    at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:187)

    at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)

    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:254)

    at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:224)

    at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:117)



  • BATTERY Thursday, November 27, 2008

    Hi, I have a problem of accessing web service methods, I have user name and password and I am using netbeans 6 but I don't know how to use them. I developing web service client. Server have been developed by other programmer they just given me wsdl file only.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.