服务器未能识别 HTTP 标头 SOAPAction 的值


 

SOAPAction HTTP request header被用来标识SOAP HTTP请求的目的地,其值是个URI地址。SOAP发送并不限制格式、URI特征或其必须可解析,那么在这种情况下,发送一个HTTP SOAP请求时,其HTTP客户端必须使用/指明SOAPAction HTTP request header。

SOAPAction header的内容可以被用在服务端,诸如:防火墙适当的过滤基于HTTP的SOAP请求消息等场景。SOAPAction header的值为空串("")表示SOAP消息的目的地由HTTP请求的URI标识;无值则表示没有指定这条消息的目的地。

跨平台调用Web Service出现:"服务器未能识别 HTTP 标头 SOAPAction 的值"的解决办法:

症状一:

Web Service + ASP.NET 应用程序部署到服务器默认目录中,在IE中用http://<服务器地址>/<程序目录名>/<默认启动页面名>发生“服务器未能识别 HTTP 标头 SOAPAction 的值”错误。

症状二:

在通过WCF 客户端ChannelFactory<> 上调用.NET Web Service的服务时,出现"服务器未能识别 HTTP 标头 SOAPAction 的值"。

解决对策:

给.NET的WebService类(即.asmx文件下的类)添加属性[SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)]

    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [SoapDocumentService(RoutingStyle= SoapServiceRoutingStyle.RequestElement)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    // [System.Web.Script.Services.ScriptService]
    public class SubmitFormTestService : System.Web.Services.WebService

阅读更多

System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTPSOAPAction 的值:

05-12

java调用c# webservice 报如下错误:rn[code=java]rnrnrnSystem.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction 的值: http://goodstest.epass.net.cn:9901/WebService/GoodsWebService.asmx?wsdl。rn 在 System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()rn 在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)rn 在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()rn 在 System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)rn 在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)rn at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)rn at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)rn at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)rn at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)rn at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)rn at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)rn at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)rn at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)rn at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)rn at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)rn at org.apache.axis.client.Call.invokeEngine(Call.java:2784)rn at org.apache.axis.client.Call.invoke(Call.java:2767)rn at org.apache.axis.client.Call.invoke(Call.java:2443)rn at org.apache.axis.client.Call.invoke(Call.java:2366)rn at org.apache.axis.client.Call.invoke(Call.java:1812)rn at com.test.TestWebService.postInfo(TestWebService.java:30)rn at com.test.TestWebService.main(TestWebService.java:15)rn[/code]rnrnrnjava代码如下:rnrn[code=java]rnprivate static void webMethod(String msg) rn String endpoint = "http://goodstest.epass.net.cn:9901/WebService/GoodsWebService.asmx?wsdl";rn Service service = new Service();rn try rn Call call = (Call) service.createCall();rn call.setTargetEndpointAddress(endpoint);rn call.setUseSOAPAction(true);rn call.setOperationName(new QName("http://tempuri.org/", "GetDate"));// WSDL里面描述的接口名称rn call.addParameter(new QName("http://tempuri.org/","GetDateSoapIn"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 接口的参数rn call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);rn call.setSOAPActionURI(endpoint);rnrn String result = (String) call.invoke(new String[] msg );rn System.out.println("result is " + result);rn catch (ServiceException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn catch (RemoteException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn[/code]rnrnrnrnrn

没有更多推荐了,返回首页