我正在使用以下CXF客户端调用SOAP Web服务:
QName serviceQName = new QName("Namespace", "ServiceName");
String urlString = "https:endpoint?wsdl";
QName portQName = new QName("Namespace", "PortName");
service = Service.create(serviceQName);
service.addPort(portQName, SOAPBinding.SOAP12HTTP_BINDING, urlString);
Dispatch<Source> sourceDispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD);
BindingProvider bindingProvider = sourceDispatch;
bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlString);
bindingProvider.getRequestContext().put(TLSClientParameters.class.getName(), tlsParams);
Source result = sourceDispatch.invoke(new StreamSource(exchange.getIn().getBody(InputStream.class)));
我得到以下错误:
javax.xml.ws.soap.SOAPFaultException: An error occurred when verifying security for the message
1条答案
按热度按时间dhxwm5r41#
解决方案是添加一个SOAP操作和一些HTTP标头,如下所示: