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