Many books only describe how to create an XML WebService. They do not describe the working principle of XML WebService and its parts in detail (for example, IIS Asp.net)
In XML WebService.
After learning, I sorted it out, hoping to help readers!
(1). xml WebService
XML WebService plays the same role in applications as the. NET remote call processing component.
Users cannot directly use WebService, but can only use the Asp.net web application or Windows Desktop
Client to call.
(2) differences between. xml WebService and. NET remote processing
1. xml WebService has more restrictions than. NET remote processing objects. It is similar to. NET remote processing.
. You cannot create a separate object or an object activated by the client.
2. the creation and Design of XML WebService is easier/simpler than that of Remote components.
3. NET remote processing of binary communication is faster than XML WebService SOAP format communication.
4. xml WebService is more scalable than. NET remote processing. It supports open standards for cross-platform use.
5. xml WebService does not need a dedicated Host Program, but is carried by Asp.net. You can access important
Platform services, such as data cache, network session Status Management, identity authentication, and global sharing application sets. And. net
Remote processing makes it difficult to implement these functions.
6. xml WebService runs on IIS and ASP. NET and uses the HTTP channel (port 80) to communicate with the customer.
You can freely cross the firewall.
(3) creation and calling of. xml WebService
I. Create a server
1. Use IIS to create a new virtual directory on the Web server to store XML Web Services.
2. Create an XML WebService class and use the [webmethod] attribute to mark the method that can be called remotely.
3. Deploy the XML Web Service file in the virtual directory.
Ii. Client usage
1. the XML WebService is found by the client through URL or file query or UDDI registration.
2. client request description XML WebService's WSDL document.
3. The client generates a proxy class based on the WSDL document.
4. The client generates an instance of the proxy class and calls XML WebService to send messages and accept the processed results.
That is to say, calling XML WebService is completed by the proxy instance object generated by the client.
(4) Role of IIS
1. IIS provides access to the Web server through the virtual directory. Simply put: Map "C:/myweb"
A URL-based virtual directory: "http: // 192.168.83.66/myweb"
On the computer to access WebService.
2. the permissions of virtual directories are different from those of normal directories. According to the default settings, remote users are not allowed to view virtual directories and run
Executable files: create files and download certain file types. You can customize IIS virtual directory permission settings as needed.
3. IIS makes public processing on the Internet. IIS is not responsible for running ASP, Asp.net, or XML WebService,
Maintains a list of registered file extensions. If IIS receives a request for a certain file type, it submits the work
Asp.net Worker Process, which processes the remaining work.
(5) Data Types supported by. xml WebService and soap standards
I don't know if the reader has encountered this situation. When WebService is called and a datarow parameter is passed to a method
Will throw an exception: "unable to serialize parameters! ", If you add datarow to dataset and use dataset as the parameter
It is OK to pass and run again. This is because: XML WebService can only serialize the dataset DataSet object type in XML format,
Errors Caused by XML serialization of datarow object types are not allowed.
This data type is important. It supports the following data types:
1. Basic data type.
Standard type, such as int float bool datetime string and other basic data types
2. enumeration.
Enum-defined types supported
3. Custom object.
You can pass any object created based on a custom class or structure. Note that only data members (variables and attributes) can be transmitted ).
If a method is defined, the method cannot be serialized and transmitted. Only data members are left after serialization.
4. DataSet object
Dataset is supported. Remember: datatable and datarow are not supported. dataset is already the smallest serializable object supported by XML WebService.
5. xmlnode object
Xmlnode-based objects can represent part of an XML document.
6. arrays and collections
Any supported types of arrays and simple collections can be used, including DataSet object/xmlnode object and custom object.
In addition, for example code for creating an XML WebService instance, almost any book that involves WebService will talk about it. Create
WebService is very simple. I will not talk about it here.