You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Pramod Pawar <pr...@gmail.com> on 2006/01/10 20:25:52 UTC

Problem with managing username token programatically.

Hi,

 

I am facing some problem with the web service sample provided with the WSS4J
using Username Token. I have correctly deployed the web service on Tomcat
server. My service is running properly and I am able to access it using
Client, here in this case I am referring to client-config.wsdd in which I
have configured the Username token.

 

I am facing problem while managing Username token programmatically at client
side. Please find the code snippet of client program as mentioned below,

 

        PWCallback pwCallback = new PWCallback();

        HelloWorldServiceLocator locator = new HelloWorldServiceLocator();

        Remote remote = locator.getPort(HelloWorld.class);

        Stub axisPort = (Stub) remote;

        axisPort._setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN);

        axisPort._setProperty(UsernameToken.PASSWORD_TYPE,
WSConstants.PASSWORD_DIGEST);

        axisPort._setProperty(WSHandlerConstants.USER, "wss4j");  

        axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_REF,
pwCallback);      

        HelloworldSoapBindingStub service =
(HelloworldSoapBindingStub)axisPort;    

        String mess = service.sayHello(args[0]);

        System.out.println("hello world service returned : " + mess );  

 

I am getting error message as mentioned below,

 

Exception in thread "main" AxisFault

            faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.generalException

            faultSubcode:

            faultString: WSDoAllReceiver: Request does not contain required
Security header

 

 faultActor:

 faultNode:

 faultDetail:

 

It seems that web service is not able to get the Username token from Soap
request. I used soap tracing utility to trace the soap request which is
going to web service in which I observed that web service contains the plain
soap message, it doesn't include the username token to it.

 

Please help me.

 

Thanks - Pramod