Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does a web service server process a URL? (And some reflection about URL in WCF)
    text
    copied!<p>I am new to WCF. One of the <strong><em>uncomfortable</em></strong> thing that I encountered is to use an URL (endpoint) to represent a method (web service), and use HTTP to invoke it.</p> <p>An endpoint is composed of <strong>ABC</strong> - <em>Address, Binding, Contract</em> (i.e. interface). And it looks like this:</p> <pre><code>http://www.myserver.com/myservice.svc </code></pre> <p>I usually put URL like this in the web browser and expect some page comes back.</p> <p>The URL above I sent to the server is merely one of the many strings I sent with HTTP GET method. How exactly does the web service server locate a proper method with that URL string? I think the server should just do the following steps:</p> <p>1 - Do some trivial parsing against the URL string, then the server will know the Binding protocol and Address, (this is the <strong>A</strong> and <strong>B</strong> part of the aforementioned <strong>ABC</strong>).</p> <p>2 - Then, the <em>service host process</em> check the config file (be it app.config or web.config) and locate the target <em>service type</em>.</p> <p>3 - The <em>service host process</em> (be it a console application, WinForm application, or a IIS worker process) should already load the <em>service type</em> into its address space. With the service type info found in step 2, it could use reflection to invoke proper method. ( But I am not sure how does the client send "<em>which-method-of-the-service-type-I-want-to-invoke</em>" info to the server. After all, we could only locate the service type info through an endpoint ). </p> <p>So, from the above perspective, the URL is just an identification symbol, just like URL is used as <strong><em>xmlns</em></strong> attribute value. </p> <p>Is the above understanding right?</p> <p>Thanks for your answer.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload