【解决方法】服务器未能识别 HTTP 标头 SOAPAction

在class上增加SoapDocumentService(routingstyle:=SoapServiceRoutingStyle.RequestElement),解决了问题,但是在webmethod中却不能得到soapheader,请帮忙这种情况下怎样得到soapheader,

方法前添加如下语句试试:
[WebMethod]
[System.Web.Services.Protocols.SoapHeaderAttribute("AuthenticationInfo")]

说明:AuthenticationInfo是封装在soapheader中的一个类对象,存放认证的信息。

try to add

[SoapDocumentService(RoutingStyle=SoapServiceRoutingStyle.RequestElement)]

before your webservice class

你没说清楚是什么情况下产生的。

一种情况是:使用WSE后,客户端没有加SOAPHeader信息;

二种情况是:是VS.NET2003在Debug版时的一个Bug,你改在Release版发布服务就没这个问题了。

v三种情况是: WebService端类的命名空间与Proxy端代理类的命名空间不一致。


终于找到解决办法了 :)

停止IIS服务,清除Temporary ASP.NET Files目录

(%WINDOWS%/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files).

Problem goes away.

I face this problem

Server did not recognize the value of HTTP Header SOAPAction

when I was trying to connect to a web service deplyed in IIS ASP.NET 2.0

The problem was the attributes of the methods of client proxy and web service was different

for example: //original web service method [WebMethod] public string example(short m)

//client proxy method [System.Web.Services.Protocols.SoapRpcMethodAttribute(”http://yourwebsite/”, RequestNamespace=”http://yourwebsite/”, ResponseNamespace=”http://yourwebsite/”)] [return: System.Xml.Serialization.SoapElementAttribute(”Result”)] public string example(short m)

Me.thank(you);


The error occurs from the published website application when it tries to call the newly published webservice in the service application...  both applications are on the same machine, but that shouldn't matter

Anyways, in the sea of discussion of this error message, i found a post somewhere to put:

_

//===================================================================

//  我的解决方法:


1. 删除web引用,重新添加;
2. 将app.config中的localhost改为对应ip地址。

 

in the class definition and that did the trick.......   yes, it works, but it does nothing to ease the bad taste that problems like this and other needed workarounds/flat-out-hacks leave behind

 

 

你可能感兴趣的:(【解决方法】服务器未能识别 HTTP 标头 SOAPAction)