0 Replies Latest reply on Mar 27, 2012 7:57 AM by seeaganesh

    Jboss 6.1.0 + Jboss native WS + SSL

    seeaganesh

      Hi,

      I have following configuration.

       

      AppServer : Jboss 6.1.0 with JbossWS native stack

      OS : Windows XP

       

      I deployed a WS, (EJB3 exposed as WS) on the app server. I enabled the SSL on my AS as per the documentation/blog/discussion threads.

       

      https://community.jboss.org/thread/196715

       

      The configuration is working. Since I am able to consume this demo WS, through SSL.

       

      i)  Interface

      package com.gj.ejb.three;

      import javax.jws.WebParam;

      import javax.jws.WebService;

      @WebService

      public interface HelloRemote

      {

      public String echo(String input);

      }

       

      ii)  Service Implementation

      package com.gj.ejb.three;

      import javax.ejb.Remote;

      import javax.ejb.Stateless;

      import javax.jws.WebMethod;

      import javax.jws.WebService;

      import javax.jws.soap.SOAPBinding;

      @WebService(name = "HelloRemote", serviceName = "HelloWorldService")

      @SOAPBinding(style = SOAPBinding.Style.RPC)

      @Remote(HelloRemote.class)

      @Stateless (name = "HelloRemote")

      //-----------------(1)

      /*

      @SecurityDomain("JBossWS")

      @RolesAllowed("friend")

      @WebContext

        contextRoot="/my-cxt",

        urlPattern="/*",

        authMethod="BASIC",

        transportGuarantee="CONFIDENTIAL",

        secureWSDLAccess=false

      )

      */

       

      public class HelloWorld implements HelloRemote

      {

         @WebMethod

         public String echo(String input)

         {

            return input;

         }

        

      }

       

      iii) client :

       

      package com.gj.client;

      import java.net.MalformedURLException;

      import java.net.URL;

       

      import javax.xml.namespace.QName;

      import javax.xml.ws.Service;

       

      import com.gj.ejb.three.HelloRemote;

       

      public class WsClient {

       

          public static void main(String args[]) throws Exception {

                String endpointURI ="https://IND-PNE3DXP2725:8743/ejbthree/HelloWorldService/HelloRemote?wsdl";    //---------(2)

                 // String endpointURI ="https://IND-PNE3DXP2725:8743/my-cxt?wsdl"; ---------------------(3)

                String helloWorld = "Hello world!";

                   System.setProperty("javax.net.ssl.keyStore","./resources/gg.keystore");

                  System.setProperty("javax.net.ssl.keyStorePassword","Deepa4sept");

                  System.setProperty("javax.net.ssl.trustStore","./resources/gg.keystore");

                  System.setProperty("javax.net.ssl.trustStorePassword","Deepa4sept");

                 

                Object retObj = getPort(endpointURI).echo(helloWorld);

                System.out.println(retObj);

              } 

               private static HelloRemote getPort(String endpointURI) throws MalformedURLException   {

                 QName serviceName = new QName("http://three.ejb.gj.com/", "HelloWorldService");

                 URL wsdlURL = new URL(endpointURI);

                  

                 Service service = Service.create(wsdlURL, serviceName);

                 //service.getPorts();

                 return service.getPort(HelloRemote.class);

               }

      }

       

       

       

      The above client works successfully.

       

      Now when I uncomment (1) & (3)  and comment (2), the client fails with the following exception

       

       

      Exception in thread "main" com.sun.xml.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized

          at com.sun.xml.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:222)

          at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:179)

          at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:93)

          at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)

          at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)

          at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)

          at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)

          at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)

          at com.sun.xml.ws.client.Stub.process(Stub.java:319)

          at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:157)

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

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

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

          at $Proxy18.echo(Unknown Source)

          at com.gj.client.WsClientM.main(WsClientM.java:48)

       

       

      Can someone please suggest me, what changes I should make in client so that it will run.

       

      Regards

      Ganesh