Web servicer呼叫異常org.apache.cxf.binding.soap.SoapFault * are not understood.
客戶端程式碼:
...
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// 註冊WebService介面
factory.setServiceClass(IRemoteAccessor.class);
// 設定WebService地址
factory.setAddress(webServiceUrl);
//***注入攔截器,用於加密安全驗證資訊************************
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, userName);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, WsClinetAuthHandler.class.getName());
ArrayList<SoapInterceptor> list = new ArrayList<SoapInterceptor>();
list.add(new SAAJOutInterceptor());
list.add(new WSS4JOutInterceptor(outProps));
factory.getOutInterceptors().addAll(list);
IRemoteAccessor remoteAccessor = (IRemoteAccessor)factory.create();
Client proxy = ClientProxy.getClient(remoteAccessor);
HTTPConduit conduit = (HTTPConduit)proxy.getConduit();
TLSClientParameters tlsParams = conduit.getTlsClientParameters();
if (tlsParams == null){
tlsParams = new TLSClientParameters();
}
tlsParams.setTrustManagers(getTrustManagers(keyStorePath,keyStorePassword,keyStoreType));
tlsParams.setDisableCNCheck(true);
tlsParams.setSecureSocketProtocol("SSL");
conduit.setTlsClientParameters(tlsParams);
String outXML = "";
outXML = remoteAccessor.invoke(inXml);
return outXML;
通過檢查發現問題是WebService服務端沒有配置使用者身份認證導致的,將client程式碼中的使用者身份認證去掉介面呼叫OK