转自:https://blog.csdn.net/dxfasr/article/details/25029063
在用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);}}如果修改后还是有错误:
这个时候仔细检查targetNameSpace命名空间是否正确、配置正确后、即可