How to Encrypt a soap request using a secretkeyspec?
- by rocks
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?