当前位置: 代码迷 >> Java Web开发 >> System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction 的值:该怎么处理
  详细解决方案

System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction 的值:该怎么处理

热度:813   发布时间:2016-04-16 22:25:34.0
System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction 的值:
本帖最后由 byg760 于 2014-05-12 12:59:07 编辑
java调用c# webservice 报如下错误:



System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction 的值: http://goodstest.epass.net.cn:9901/WebService/GoodsWebService.asmx?wsdl。
   在 System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   在 System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
   在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.test.TestWebService.postInfo(TestWebService.java:30)
at com.test.TestWebService.main(TestWebService.java:15)



java代码如下:


private static void webMethod(String msg) {
        String endpoint = "http://goodstest.epass.net.cn:9901/WebService/GoodsWebService.asmx?wsdl";
        Service service = new Service();
        try {
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(endpoint);
            call.setUseSOAPAction(true);
            call.setOperationName(new QName("http://tempuri.org/", "GetDate"));// WSDL里面描述的接口名称
            call.addParameter(new QName("http://tempuri.org/","GetDateSoapIn"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
            call.setSOAPActionURI(endpoint);

            String result = (String) call.invoke(new String[] { msg });
            System.out.println("result is " + result);
        } catch (ServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (RemoteException e) {
            // TODO Auto-generated catch block
  相关解决方案