Hello, I'm a newbie to WSS4J so please bare with me if this is a known issue.

I'm using WSS4J to add a Username token with a digest password to an Axis/WSDL2Java generated client that hits an external .Net web service, but keep getting an error when sent.

This is what I get:

faultCode: {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}FailedAuthentication
faultSubcode:
faultString: Microsoft.Web.Services2.Security.SecurityFault: The security token could not be authenticated or authorized ---> System.Exception: WSE563: The computed password digest doesn't match that of the incoming username token.


Is there something that I maybe missing? Something where I need to specifiy the type of encoding. I've followed the example that's floating around and the code is as follows.

public class LocatorClient {
public static void main(String[] args){
try{
EngineConfiguration config = new FileProvider("client_deploy.wsdd");
LocatorService service=new LocatorServiceLocator(config);
Remote remote = service.getPort(LocatorServiceSoap.class);
Stub axisPort = (Stub)remote; axisPort._setProperty(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN);
axisPort._setProperty(UsernameToken.PASSWORD_TYPE,WSConstants.PASSWORD_DIGEST);
axisPort._setProperty(WSHandlerConstants.USER, "someusername");
axisPort._setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,"com.mycallbacks.PWCallBack");
LocatorServiceSoap port=(LocatorServiceSoapStub)axisPort;
System.out.println("Calling Service");
Calendar cal=port.getServerTime();
System.out.println(cal.getTime());
}catch(Exception e){
e.printStackTrace();
}
}
}


<deployment xmlns="http://xml.apache.org/axis/wsdd/"; xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
<transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
<globalConfiguration >
<requestFlow >
<handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
</handler>
</requestFlow >
</globalConfiguration >
</deployment>


Any help would be appreciated.

Thanks,
Joe

Reply via email to