Search code examples
c#web-servicesinputstreamhttpmodule

How do you determine which WS method was called based on Request.InputStream?


Within a HttpModule, I'd like to figure out which web method was called/intercepted and act based on that. For example, if I called WebMethod1, do something, yet do nothing for WebMethod2.

If I look at soap:Header and soap:Body, I can see the method name but would it be alright to parse the soap:Envelope and if so, which part?


Solution

  • If the two method have a common endpoint you need to parse the SOAP message to determine what method is called. In this case you need to check the <soap:Body> tag and find the operation name that is the first element name that belongs to the body tag.