java如何延长SOAP头消息时间戳的过期时间
有没有办法延长SOAP消息头时间戳的生存时间(过期时间)以防止 “WSSecurityException:消息已过期”异常。默认设置为300秒(5分钟)。我们想把时间延长到10分钟
我们有一个JavaEE(JDK1.8.077)服务,它使用SOAP消息与安卓客户端通信。 它在Jboss Wildfly 10.0.0上运行。服务器,并使用Apache CXF(版本3.1.4)WS-security来处理消息。wss4j安全策略版本为2.1.4 我们有wsdl文件、自定义WS-Security端点(server-Endpoint-config.xml文件)和模式。xsd文件。我不知道这些文件的哪些部分是相关的,所以如果有人需要更多信息,我会提供它们。 我尝试过使用一个自定义拦截器来扩展WSS4JInInterceptor,但这部分代码永远不会执行
@WebService
(
portName = "HelloPort",
serviceName = "BampayService",
wsdlLocation = "WEB-INF/BampayService.wsdl",
targetNamespace = "http://bampay.bamcard.ba/",
endpointInterface = "ba.bamcard.bampay.Hello"
)
@EndpointConfig
(
configFile = "WEB-INF/server-endpoint-config.xml",
configName = "Custom WS-Security Endpoint"
)
@InInterceptors(// I added this part
interceptors = {"ba.bamcard.helpers.MyInterceptor"}
)
还有MyInterceptor的代码
public class MyInterceptor extends WSS4JInInterceptor {
@Override
public int decodeTimeToLive(RequestData reqData, boolean timestamp) {
// return super.decodeTimeToLive(reqData, timestamp);
return 600;
}
}
如果需要,我很乐意提供更多信息。 如果有人能帮助我,我将非常感激
共 (0) 个答案