[英]Message=Server did not recognize the value of HTTP Header SOAPAction: error
嗨,大家好,我已经创建了一个Web服务。 而且我可以使用SOAPUI来访问Web服务,但是当我尝试通过代码调用时,会出现此错误。 有任何想法吗?
好的,Web服务代码如下所示:
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[WebServiceBindingAttribute(Name = "SoapBinding", Namespace = "xyz")]
[System.ComponentModel.ToolboxItem(false)]
[WebService(Namespace = "http://Search")]
// 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 Stub : System.Web.Services.WebService
{
public Stub()
{
Log.Debug(this,string.Format("this is just a test message"));
}
[WebMethod]
public Response searchAsset(Request serviceTag)
{
}
我的客户代码是:
Search _search = new Search();
_search.url;
_search.n.wcred;
_search.searchAsset(request);
这解决了我与SoapAction的问题:
[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
SoapServiceRoutingStyle 枚举 SoapAction SOAP消息基于SOAPAction HTTP标头进行路由。 RequestElement SOAP消息基于SOAP消息的XML元素之后的第一个子元素进行路由。
我听说过的最常见原因是无论实际代码中的值如何:
[WebService(Namespace = "http://Search")]
如果此值不是服务器期望的值,则会发生您报告的错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.