node. JS uses the SOAP module to request the WebService service interface

Source: Internet
Author: User
Tags soap wsdl

The WebService service needs to be requested in project development, and the front-end uses node. js as the running environment, so you can request it using SOAP.

The process of using SOAP to request WebService services is as follows:

1. Enter the project directory and install the SOAP module

> npm Install soap--save-dev

2. Find Lib > client.js under the SOAP module in the Node_modules directory of the project,

To modify the code:

SOAPAction = ((Ns.lastindexof ("/"1"/" : NS) + name;

For:

SOAPAction = Method.soapaction | | (((Ns.lastindexof ('/'1'/': NS) + name) ;

3. Request Code

1   varSoap = require (' Soap ');2   varurl = ' http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl ';3   varargs = {byprovincename: ' Zhejiang '};4Soap.createclient (URL,function(err, client) {5Client.getsupportcity (args,function(err, result) {6       if(err) {7 Console.log (err);8}Else {9 Console.log (result);Ten       }   One     }); A});

4. Run the code and view the results in the Command line window

In addition to the SOAP module, Strong-soap, Easysoap and other modules can request WebService services. Use a similar method.

For information about WebService, SOAP, and WSDL, you can view the following links:

http://blog.csdn.net/u014511737/article/details/46986389

Http://www.jianshu.com/p/5443f90e36de

1190000006807566

http://download.csdn.net/detail/zxktxj/8643733

node. JS uses the SOAP module to request the WebService service interface

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.