I created my first web service 2 days ago in VS 2008 and was thinking about consuming it when I came across the following questions about web services:
1) My web service Test开发者_运维百科 Invocation page(canned page which comes as a part of .NET framework) does not displays any sample HTTP GET request\response messages. The only messages it displays are of HTTP POST, SOAP 1.1 and SOAP 1.2 . Shall I assume that web services are some how not encouraging the use of HTTP GET protocol for calling them?
2) To make an HTTP-POST call through browser, I created a sample html page. Can I do the same to make sample HTTP-SOAP call as well? If yes, would the response be in SOAP format? Can anyone send me such an html page.
3) How do we send Host Header information while make a call to web service through a browser?
4) Why do we call it a 'HTTP-SOAP call' when we make a call to web service using POST method(method='post')?
5) Why HTTP-SOAP should take precedence over HTTP-GET and HTTP-POST?
Thanks and Regards' Milan
Standard SOAP services are using only HTTP POST because they require complex SOAP request (XML) which cannot be included in query string.
When you want to make call to your SOAP service from web page, your page must built valid SOAP request. Because of that, SOAP calls are usually created from auto-generated service clients on server side.
We can call it HTTP-SOAP because it is a SOAP request transported by the HTTP protocol with POST method.
It doesn't take precedence. It is how SOAP services usually work. If you want to use HTTP GET and HTTP POST you should check REST services.
First of all, you may have made a mistake. Did you create a service with a .ASMX extension?
That is a legacy "ASMX" web service, and should not be used for new development unless you have no choice. WCF should be used for all new development.
Second, GET cannot be used to send complex types to the service, as it places the parameters into the query string. POST, is actually of little use, except for the test page (it also cannot send complex types).
The only thing that really matters for such a service is SOAP. You should create a client application of some kind to test it, perhaps a set of unit tests.
精彩评论