Java org.apache.cxf.binding.soap.SoapFault:“您必须遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他有关法律法规。”;验证消息“时遇到安全错误”;
需要处理WS-Security客户端。我使用CXF3.1.11版本编写了以下java代码Java org.apache.cxf.binding.soap.SoapFault:“您必须遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他有关法律法规。”;验证消息“时遇到安全错误”;,java,web-services,soap,cxf,Java,Web Services,Soap,Cxf,需要处理WS-Security客户端。我使用CXF3.1.11版本编写了以下java代码 WSSSecurityProperties properties = new WSSSecurityProperties(); properties.addAction(WSSConstants.USERNAMETOKEN); properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIG
WSSSecurityProperties properties = new WSSSecurityProperties();
properties.addAction(WSSConstants.USERNAMETOKEN);
properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
properties.setTokenUser("test");
properties.setCallbackHandler(new UTPasswordCallback());
properties.addAction(WSSConstants.TIMESTAMP);
WSSSecurityProperties inProperties = new WSSSecurityProperties();
inProperties.addAction(WSSConstants.USERNAMETOKEN);
inProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
inProperties.setCallbackHandler(new UTPasswordCallback());
inProperties.addAction(WSSConstants.TIMESTAMP);
GreetingDetailsService detailsService = new GreetingDetailsService();
GreetingDetails details = detailsService.getGreetingDetailsPort();
Client client = ClientProxy.getClient(details);
client.getOutInterceptors().add(new WSS4JStaxOutInterceptor(properties));
client.getInInterceptors().add(new WSS4JStaxInInterceptor(inProperties));
soap请求:
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-4F89DE365A2FAA9F8E14957130295985">
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">abcdefgh</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">m83qX0a/bD3xOLXGOLR1bA==</wsse:Nonce>
<wsu:Created>2017-05-25T11:50:29.598Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
测试
abcdefgh
m83qX0a/bD3xOLXGOLR1bA==
2017-05-25T11:50:29.598Z
运行java代码时,获取org.apache.cxf.binding.soap.SoapFault:“验证消息时遇到安全错误”
error message
请告诉我如何处理这个问题