Webservice series teaching (3)-How to call webservice

Source: Internet
Author: User
4. How to call webservice
4.0 webservice call Process
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 automatically parses the WSDL file and generates the method and parameter information of all Web services internally. Then, you can call all the methods in the IDispatch interface just like calling the methods in it. In VB or script language, you can even directly add a. Method (parameter…) after the name of the SoapClient object ...) .
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. Create a SoapSerializer object to generate a Soap message. According to the definition in WSDL, all parameters are serialized in order to obtain a complete SOAP request message. This Soap message is sent to the server as Payload through HttpConnector. 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.