在用java发送给webservice服务器的时候报如下错误: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client faultSubcode: faultString: 服务器未能识别 HTTP 头 SOAPAction 的值: 。 faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:服务器未能识别 HTTP 头 SOAPAction 的值: 。 解决办法: Call call = (Call)service.createCall(); //加入如下的方法:在调用的时候直接写 call.setSOAPActionURI(方法名); 写好的调用的例子如下: public static String invokeRemoteAddr(String wsdl, String method, Object[] objects) throws Exception { Service service = new Service(); Call call; try { call = (Call) service.createCall(); call.setSOAPActionURI("http://tempuri.org/receiveDataTask"); call.setTargetEndpointAddress(wsdl); call.setOperationName(method);// WSDL里面描述的接口名称 call.addParameter("orig", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数 call.addParameter("sign", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数 call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);// 设置返回类型 call.invoke(objects); return "end"; } catch (ServiceException e) { throw new Exception(e); } } 如果修改后还是有错误: 1.java调用错误变成了:faultString: 无法识别请求元素 <GetTestQuestions xmlns=>。 解决办法:这个时候仔细检查targetNameSpace命名空间是否正确、配置正确后、即可
在用java发送给webservice服务器的时候报如下错误: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client faultSubcode: faultString: 服务器未能识别 HTTP 头 SOAPAction 的值: 。 faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:服务器未能识别 HTTP 头 SOAPAction 的值: 。 解决办法: Call call = (Call)service.createCall(); //加入如下的方法:在调用的时候直接写 call.setSOAPActionURI(方法名); 写好的调用的例子如下: public static String invokeRemoteAddr(String wsdl, String method, Object[] objects) throws Exception { Service service = new Service(); Call call; try { call = (Call) service.createCall(); call.setSOAPActionURI("http://tempuri.org/receiveDataTask"); call.setTargetEndpointAddress(wsdl); call.setOperationName(method);// WSDL里面描述的接口名称 call.addParameter("orig", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数 call.addParameter("sign", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数 call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);// 设置返回类型 call.invoke(objects); return "end"; } catch (ServiceException e) { throw new Exception(e); } } 如果修改后还是有错误: 1.java调用错误变成了:faultString: 无法识别请求元素 <GetTestQuestions xmlns=>。 解决办法:这个时候仔细检查targetNameSpace命名空间是否正确、配置正确后、即可