Lule,

Hopefully Ruchith will chime in, i have no clue :)

-- dims

On 2/23/07, Lule Chen <[EMAIL PROTECTED]> wrote:



Hi, dims:

I adopted the code in TestWSSecurityNew15.java that encrypts the soap body,
but I got the null pointer exception as the following:

Exception in thread "main" java.lang.NullPointerException
        at
org.apache.ws.security.message.WSSecEncrypt.prepare(WSSecEncrypt.java:197)
        at
com.nortel.cdma.axis.Client.NEServiceClient.main(NEServiceClient.java:240)

I looked at the line of code in WSSecEncrypt.java, it seems failed at

                this.symmetricKey = keyGen.generateKey();

I suspect that keyGen is null. My code snips are as the following:

    static final WSSecurityEngine secEngine = new WSSecurityEngine();
    static final Crypto crypto =
CryptoFactory.getInstance("cryptoSKI.properties");

...

        SOAPEnvelope env = new SOAPEnvelope(new
ByteArrayInputStream(byteBuf));

        WSSecEncrypt encrypt = new WSSecEncrypt();
        encrypt.setUserInfo("wss4jcert", "security");

encrypt.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);

encrypt.setSymmetricEncAlgorithm("WSConstants.TRIPLE_DES");

        Document doc = env.getAsDocument();

        WSSecHeader secHeader = new WSSecHeader();
        secHeader.insertSecurityHeader(doc);
        encrypt.prepare(doc, crypto);

...

Do you have any idea whats wrong of my code?

Thanks,


Lule




--
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to