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

当遇到服务器未能识别SOAPAction HTTP标头的问题时,可能的原因包括WSE客户端缺失SOAPHeader、VS.NET 2003 Debug版的Bug、命名空间不一致或ASP.NET临时文件问题。解决方案可以尝试清理Temporary ASP.NET Files目录、调整WebService和客户端方法属性一致性,或者删除并重新添加Web引用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在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:

<SoapDocumentService(RoutingStyle:=SoapServiceRoutingStyle.RequestElement)> _

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

//  我的解决方法:


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

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值