我尝试使用eclipse + axis在WSDL生成的WS Client中签名SOAP消息。
这是代码:
_call.setOperation(_operations[2]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("http://hostname/operation");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("", "EFACRECEPCIONSOBRE"));
//Firma
try {
Properties configuration = new Properties();
configuration.load(new FileInputStream(new File("C:\\trabajo\\sts-bundle\\sts-3.7.3.RELEASE\\workspace\\tmp\\securityConfiguration.properties")));
//Handler que maneja la petición
ClientHandler sender = new ClientHandler(configuration);
_call.setClientHandlers(sender, null);
} catch (Exception e) {
e.printStackTrace();
}
setRequestHeaders(_call);
setAttachments(_call);
try {
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {parameters});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
xxxxxxxx_resp;
} catch (java.lang.Exception _exception) {
xxxxxx
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
但是我收到了这个错误:
null cannot create instance
执行客户端时,在此行中:
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {parameters});
有什么想法吗?
答案 0 :(得分:0)
安全配置参考文件中的错误导致此错误。在Windows上引用密钥库必须将\设置为\。