Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOAP Request Fails when parameter is supplied

When i call my Soap ASMX service with the parameter orderid , it fails and says . Any ideas?

System.InvalidOperationException: Request format is invalid: text/xml; charset=utf-8.
   at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

public class Service1 : System.Web.Services.WebService {

    [WebMethod(EnableSession=true)]
    [SoapDocumentMethod]

    public Order MyLiteralMethod([XmlElement("MyOrderID")] string orderId)
    {

       //logic
    }
}

FIDDLER REQUEST HEADER

Host: localhost:49033
Content-Type: text/xml; charset=utf-8
Content-Length: 369
SOAPAction: "http://tempuri.org/MyLiteralMethod"

FIDDLER REQUEST BODY

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <MyLiteralMethod xmlns="http://tempuri.org/">
      <MyOrderID>sdasd</MyOrderID>
    </MyLiteralMethod>
  </soap:Body>
</soap:Envelope>

FURTHER FINDINGS I am able to call the service and pass parameter from other web debugging proxy tools[STORM]. I think this is specific to fiddler

Problem Resolved

Seems like a issue with fiddler .went into tools->options->https.. Removed decrypt HTTPs traffic.. Restarted fiddler. Then re added those options back again and restarted. I dont know if this process solved the problem but i am able to make request via fiddler.

like image 392
Chief Avatar asked Aug 15 '13 01:08

Chief


1 Answers

I just had the same problem with an old ASMX service (this has nothing to do with Fiddler). Solution:

You are calling your web service using the SOAP protocol. I'm guessing that the URL you use to call it is:

http://yourserver/service.asmx/methodOfService

However, this URL must be used when you do a simple GET or POST to your service (when using AJAX for instance). When using SOAP, you must use this URL:

http://yourserver/service.asmx

No method name, because it is included in the SOAP body.

like image 174
Matthieu Avatar answered Nov 01 '22 11:11

Matthieu