nodejs+soap请求

凤晨朗
2023-12-01
   var soap = require('soap');
   var url = 'http://220.169.236.108:4020/hnjyjcService/service1.asmx?wsdl';
   var args = { untcode:'oldwiner',
	            deviceld:"x674361",
		    username:"18071996460",
		    password:'我是朗杰'
	};
   soap.createClient(url, function(err, client) {
	   
     client.Login(args, function(err, result) { //login是方法是别人定义的接口方法
       if (err) {
         console.log(err);
       }else {
         console.log(result);
      }  
    });
  });


http://220.169.236.108:4020/hnjyjcService/service1.asmx    //例子的文档所有的api


   var soap = require('soap');
   var crypto=require('crypto');
   var url = 'http://192.168.1.2:8080/DRM_LAB/services/SGCMSwitchProject?wsdl';
	var AppSecret="2e33edf32o34492uf58f233ksl3er60f";
	var Appkey="169827";
	var date="2012-5-17 13:42:17";   //时间戳
	var sample="CB1-17/03/28-001";  //样品编号
	
    var md5=crypto.createHash("md5");
	md5.update(AppSecret+"sampleNo"+sample);
	var str=md5.digest('hex');
   var Appsign=str.toUpperCase();  //32位大写
	var sysParams=Appkey+"|"+date+"|"+Appsign;
	console.log(sysParams);


   var args = { sampleNo:"CB1-17/03/28-001",
	            sysParams:sysParams,
				checkTemp:"35",
				checkWet:"25"
	};
   soap.createClient(url, function(err, client) {
	   
     client.getSampleInfo(args, function(err, result) {
       if (err) {
         console.log(err);
       }else {
         console.log(result);
      }  
    });
  });


 类似资料: