Introduction to webservie+soap+wsdl
/web services/weather web service . asmx
/web services/weather web service . asmx? WSDL
Recently, due to some special requirements, I need to provide a soap-based webservice. I have no experience before and don't know how to do it. So I looked up a lot of things from the internet, a lot of information, but most of them are not detailed enough. Later, I found the description of the weather forecast webservice, and I understood it a little. I wrote it here to give you a primer.
I think this webservice can be divided into narrow sense and broad sense.
Broadly speaking, webservice is almost literally: web+service, which means service networking. What he strives for is the cross-language, cross-platform and remote calling ability based on web transmission. He didn't emphasize what protocol to use for remote calling, and he was free to choose, such as soap protocol (which can be used with/webservices/weatherwebservice.asmx).
Corresponding to the more readable introduction of this document, his actual interface document is
/web services/weather web service . asmx? WSDL
This interface document actually describes multiple interfaces. Of course, there is only one to describe here, and the interface is
getWeatherbyCityName
/web services/weather web service . asmx? op=getWeatherbyCityName
This page has a detailed request body and return results, which is very specific. Let's analyze what is in his actual interface document wsdl.
We know that wsdl documents contain several parts.
Next, we use the interface getWeatherbyCityName to explain the corresponding part of the total xml, and extract the xml as follows.
When studying the following documents, please also refer to the corresponding visual documents.
compare
Intercepted from here
getWeatherbyCityName
The following are examples of SOAP 1.2 requests and responses. The displayed placeholders need to be replaced with actual values.
The following are examples of SOAP 1.2 requests and responses. The displayed placeholders need to be replaced with actual values.
The following are examples of HTTP GET requests and responses. The displayed placeholders need to be replaced with actual values.
The following is an example of an HTTP POST request and response. The displayed placeholders need to be replaced with actual values.