7

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.

2
  • ASMX is a legacy technology, and should not be used for new development. WCF should be used for all new development of web service clients and servers. One hint: Microsoft has retired the ASMX Forum on MSDN. Aug 15, 2013 at 1:52
  • 2
    @JohnSaunders thanks for tip but unfortunately ill have to use that as per the current infrastructure and business requirement
    – Chief
    Aug 15, 2013 at 1:54

2 Answers 2

27

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.

4
  • 1
    that was the case for me. Thanks
    – max
    Jan 17, 2015 at 20:08
  • I've been fighting with this for hours. Thanks so much! Sep 25, 2018 at 7:11
  • This was my solution.
    – John Mott
    Oct 3, 2018 at 17:32
  • You saved my day :) Thank you a million times! It was working in a VS generated client but not in postman because of this (my) mistake.
    – ggo
    May 7, 2022 at 14:56
0

There's nothing magical that Fiddler's doing here. Your simplest approach is to capture a working request with Fiddler, then use the Compare feature to compare that to the non-working request that you issued from the Composer tab.

Did you remember to set the HTTP Verb to POST?

If you remove the space before the charset, is there a change? Content-Type: text/xml;charset=utf-8

1
  • i havent got any working request in fiddler to compare to. I got the request working from other tool called STORM. That space didnt make any diffrence
    – Chief
    Aug 15, 2013 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.