Principles of WebService and soap

Source: Internet
Author: User

What is Web Services
  
On the surface, Web Service is an application that exposes an API that can be called through the Web. That is to say, you can use programming methods to call this application through the Web.
  
 
A more accurate explanation of Web Services: Web Services is a new platform for building interoperable distributed applications. Web
The service platform is a set of standards that define how applications implement interoperability on the web. You can use any language you like to write Web on any platform you like.
Service, as long as we can query and access these services through the Web service standard.
  
Regardless of your Web
What tools and languages are used for the service? The overall structure is consistent as long as you use the SOAP protocol to call it over HTTP. Generally, you use your favorite language (such as VB
6 or VB. NET) to build your web service, and then use soap
Toolkit or built-in support of. Net to expose it to Web customers. Therefore, customers in any language and platform can read its WSDL document to call this web
Service. The customer generates a SOAP request message based on the WSDL description. Web services are deployed on Web servers (such as IIS)
Later, the SOAP request generated by the customer will be embedded in an http post request and sent to the web server. The Web server then forwards these requests to the Web
Service request processor. The request processor parses the received SOAP request and calls the Web
Service, and then generate the corresponding soap response. After the Web server receives a soap response, it will send it back to the client through HTTP response.
Bbs.bitscn.com China Network Management Forum
  
Basic Concepts
  
Soap
  
XML and XSD
  
WSDL (Web Services Description Language)
  
Wsml (Web Services meta LANGUAGE)
  
When to use Web Services
  
Web Service is a new platform for creating interoperable distributed applications. The main goal of Web Service is cross-platform interoperability. To achieve this goal, Web services are fully based on XML, XSD, and other standards independent of platforms and software vendors.
  
Web service is very useful when applications communicate across platforms and networks. Web Service is suitable for application integration, B2B integration, code and data reuse, and communication between clients and servers through the Web.
  
Of course, Web services are not omnipotent. You cannot abuse web services everywhere. In some cases, Web Service Reduces the application performance without any benefits. For example, a homogeneous application running on a machine or a LAN should not communicate with Web Services.
  
How to call Web Services
  
Client: Get the service description file WSDL of the server, parse the content of the file, understand the service information of the server, and call method. Generate the appropriate SOAP request message (specify the method to call and the parameters already called) as needed and send it to the server. Wait for the soap response message returned by the server and parse it to get the return value.


Server: generate a service description file for the client to obtain. Receives the SOAP request message from the client and parses the method call and parameter format. According to the description of WSDL and wsml, call the corresponding COM object to complete the specified function, and put the returned value into the soap Response Message and return it to the user.
  
High-level Interface
  
A WebService can be generated and used without knowing any information about soap and XML. Soap Toolkit 2.0 provides two COM objects-soapclient and soapserver.
  
 
On the client, you only need to generate a soapclient instance and use WSDL as the parameter to call the mssoapinit method. The soapclient object is automatically parsed.
The WSDL file and generate all web
Service method and parameter information. Then, you can call all the methods in the idispatch interface just like calling the methods in it. In VB or scripting, you can even directly
Add the. Method (parameter…) directly after the soapclient object name ...) .
  
Lower Layer Interface
  
To use lower-layer interfaces, you must understand soap and XML. You can control the processing of soap, especially for special processing.
  
 
On the client, you must first create an httpconnector object for HTTP connection. Set some header information of connector, such as endpoinurl and
Soapaction. If you need to use a proxy server for network connection, set the relevant information here. Then create the soapserializer object to generate the soap consumer
. According to the definition in WSDL, all parameters are serialized in order to obtain a complete SOAP request message. The SOAP message, which is used as the payload through httpconnector
Sent to the server. Finally, a soapreader object is generated to read the SOAP message returned by the server and obtain the return value.

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.