How to implement XML WebService for Data Interaction Between iOS and PC and related knowledge

Source: Internet
Author: User
Tags wsdl

The implementation principle and related knowledge of XML WebService for Data Interaction Between http://hi.baidu.com/williamforfun/item/3b0ce2564a50d5afacc85796ios and PC

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. I hope it will help readers!

(1). xml WebService
XML WebService in Application Program And 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 the working mechanism of an independently called object in. 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 shared applications. However,. NET remote processing is 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, "C: \ myweb" is mapped to a virtual directory in the form of a URL address: "http: // 192.168.83.66/myweb" for the local machine or the Internet
On the computer to access WebService.
2. the permissions of virtual directories are different from those of normal directories. By default, remote users are not allowed to browse virtual directories, 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 does not run ASP, Asp.net, or XML WebService, but maintains a list of registered file extensions. If IIS receives a request for a file type, it submits the job to the Asp.net Worker Process, and the Asp.net Worker Process 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 calling WebService and passing a datarow parameter to a method, an exception will be thrown during runtime: "unable to serialize parameters! ", If you add datarow to dataset, and pass the dataset as a parameter before running it, it will be OK. This is because: XML WebService can only serialize the dataset DataSet object type in XML format, and Cannot serialize the datarow object type in XML format. so it is important to understand the basic data types that XML WebService supports serialization. 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.

Create an XML WebService instanceCodeFor example, almost any book that involves WebService will talk about it. It is very easy to create a WebService.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.