[jboss-dev-forums] [JBoss Web Services Development] - Jboss 6.1.0 + Jboss native WS + SSL

ganesh jadhav do-not-reply at jboss.com
Tue Mar 27 07:57:55 EDT 2012


ganesh jadhav [https://community.jboss.org/people/seeaganesh] created the discussion

"Jboss 6.1.0 + Jboss native WS + SSL"

To view the discussion, visit: https://community.jboss.org/message/726600#726600

--------------------------------------------------------------
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 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 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/ 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
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/726600#726600]

Start a new discussion in JBoss Web Services Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2047]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120327/c173fb8d/attachment.html 


More information about the jboss-dev-forums mailing list