简体   繁体   English

cxf ws-security timestamp格式

[英]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 我正在创建一个与WSDL交互的SOAP客户端, 网址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 这是我第一次实现SOAP客户端而我正在使用CXF

I'm having a trouble with the timestamp format for the request. 我遇到了请求的时间戳格式问题。

Expected format : 2014-08-05T17:46:51Z 预计格式 :2014-08-05T17:46:51Z

My format : 2014-08-05T17:42:09.954Z 我的格式 :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"); outProps.put(“precisionInMilliseconds”,“false”);

Colm. 科尔姆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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