How to Encrypt a soap request using a secretkeyspec?

Posted by rocks on Stack Overflow See other posts from Stack Overflow or by rocks
Published on 2010-04-12T08:38:02Z Indexed on 2010/04/12 8:43 UTC
Read the original article Hit count: 402

Filed under:
|
|
|

I have Web Service client code generated by WSDL2Java. I am trying to encrypt the Soap Envelope specifying a CallbackHandler in the wsdd. I've managed to set a username and password in plain text on the soap request, but I need to use a key instead (I have been given a .key file which seems to be a SecretKeySpec). I load the .key file, read the bytes and then in the CallbackHandler I do the following:-

encryptionKey = getBytesFromFile("mykey.key");
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
pc.setKey(encryptionKey);

But nothing relating to the encryption appears in the soap request and I get an error stating that pwd must be set. I'm totally stuck. Can anyone point me in the right direction?

© Stack Overflow or respective owner

Related posts about wsdl2java

Related posts about wss4j