简体   繁体   中英

cxf ws-security timestamp format

I am creating a SOAP client that interacts with WSDL at https://ws.conf.ebs.health.gov.on.ca:1440/HCVService/HCValidationService?wsdl

It's my first time implementing SOAP client and I'm using CXF

I'm having a trouble with the timestamp format for the request.

Expected format : 2014-08-05T17:46:51Z

My format : 2014-08-05T17:42:09.954Z

So the question is, how do I configure the timestamp so that the trailing sub-seconds are removed?

Much thanks in advance.

Relevant code :

    Map<String,Object> inProps= new HashMap<String,Object>();

    WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
    cxfEndpoint.getInInterceptors().add(wssIn);

    Map<String,Object> outProps = new HashMap<String,Object>();

    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
    cxfEndpoint.getOutInterceptors().add(wssOut);

    outProps.put("action", "UsernameToken Timestamp Signature");

    outProps.put("passwordType", WSConstants.PW_TEXT);

Add the following line of code + it should work:

outProps.put("precisionInMilliseconds", "false");

Colm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM