简体   繁体   中英

Message=Server did not recognize the value of HTTP Header SOAPAction: error

HI Guys, I have created a web service. And I m able to hit the web service using SOAPUI but when i try to call through my code I get this error. Any ideas?

ok the web service code looks like this:

[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)
    {
    }

And my client code is:

Search _search = new Search();
_search.url;
_search.n.wcred;
_search.searchAsset(request);

This solved my problem with the SoapAction:

[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]

SoapServiceRoutingStyle Enumeration SoapAction The SOAP message is routed based on the SOAPAction HTTP header. RequestElement The SOAP Message is routed based on the first child element following the XML element of the SOAP message.

The most common cause I've heard of this is that the value in whatever the real code of:

[WebService(Namespace = "http://Search")]

If this value isn't what the server expects, the error message you report will happen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM