SOAP Request Fails when parameter is supplied

10,514

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.

Share:
10,514

Related videos on Youtube

Chief
Author by

Chief

Updated on July 13, 2022

Comments

  • Chief
    Chief almost 2 years

    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.

    • Chief
      Chief over 10 years
      @JohnSaunders thanks for tip but unfortunately ill have to use that as per the current infrastructure and business requirement
  • max
    max over 9 years
    that was the case for me. Thanks
  • Simon Parker
    Simon Parker over 5 years
    I've been fighting with this for hours. Thanks so much!
  • John Mott
    John Mott over 5 years
    This was my solution.