[英]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.