1

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);
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
alice7
  • 3,834
  • 14
  • 64
  • 93
  • You forgot to show your code (preferably the client **and** the service). – Darin Dimitrov Aug 11 '10 at 16:40
  • I got it resolved. Actually the function which i was mocking in wsdl had some more parameters which I forgot to use. And after I added it started working. – alice7 Aug 11 '10 at 18:16

2 Answers2

7

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.

Dave
  • 196
  • 1
  • 2
  • 8
0

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.

Jon Hanna
  • 110,372
  • 10
  • 146
  • 251