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



-----Original Message-----
From: Davanum Srinivas [mailto:[EMAIL PROTECTED]
Sent: Friday, February 23, 2007 11:39 AM
To: José Ferreiro
Cc: [email protected]; [email protected]
Subject: Re: [Axis 1.4, WSS4J] - Timestamp in SOAP is one hour less than my 
current time in the computer (my timezone is : GMT+1 - Switzerland)


"Z" implies GMT.

-- dims

On 2/23/07, José Ferreiro <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am introducing the timestamp in the messages SOAP.
>
> The capture of the messages shows that the
>
> Timestamp of the REQUEST IS:
>
> <..omitted..>
>      <wsu:Timestamp xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-uti
> lity-1.0.xsd"
> wsu:Id="Timestamp-16795115">
>                <wsu:Created>2007-02-23T15:57:47.093Z</wsu:Created>
>                <wsu:Expires>2007-02-23T16:02:47.093Z</wsu:Expires>
>             </wsu:Timestamp>
> <..omitted.>
>
> Timestamp of the RESPONSE IS;
>
> <..omitted..>
>  <wsu:Timestamp
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wss
> ecurity-utility-1.0.xsd
> " wsu:Id="Timestamp-9715140">
>
> <wsu:Created>2007-02-23T15:57:48Z</wsu:Created>
>
> <wsu:Expires>2007-02-23T16:02:48Z</wsu:Expires>
>   </wsu:Timestamp>
> <..omitted..>
>
> And the current time settins of my computer is (GMT +1).
>
> Is there a way to configure that?
> Did someone notice this also?
>
> I expected to have, that is to say the timestamp accordingly with my
> timezone:
>
> <..omitted..>
>   <wsu:Timestamp
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wss
> ecurity-utility-1.0.xsd"
> wsu:Id="Timestamp-9715140">
>                 <wsu:Created>2007-02-23T16:57:48Z</wsu:Created>
>                 <wsu:Expires>2007-02-23T17:02:48Z</wsu:Expires>
>    </wsu:Timestamp>
>  <..omitted..>
>
> All answers or suggestions are welcome.
>
>
> --
> José Ferreiro
> EPFL Communication Systems engineer
> ing.sys.com.dipl.EPFL


--
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