原来是用java写的,现在初学node.js,要改写。怎么弄啊,哪位大侠可以指点一下?原来的那个xml文档里面的内容要怎么写到args里面呢?还有Header里面的东西。 headers.setHeader(“Content-Type","text/xml”); headers.setHeader(“SOAPAction","http://xxx.com/runQuery”);
文档太少了。用的是node.js v0.10.7和milewise的soap模块。
var soap = require(‘soap’); var url = 'http://xxx.com/xxx.asmx’; var args = {xxx:’abc’}; soap.createClient(url, function(err, client) { client.RunQuery(args, function(err, result) { console.log(result); }); });
报错: Error: Unexpected root element of WSDL or include at null.<anonymous> (/home/taxi/nodeapp/node_modules/soap/lib/wsdl.js:907:23) at EventEmitter.emit (events.js:98:17) at Parser.parse (/home/taxi/nodeapp/node_modules/soap/node_modules/node-expat/lib/node-expat.js:18:22) at WSDL._parse (/home/taxi/nodeapp/node_modules/soap/lib/wsdl.js:920:12) at WSDL._fromXML (/home/taxi/nodeapp/node_modules/soap/lib/wsdl.js:928:29) at /home/taxi/nodeapp/node_modules/soap/lib/wsdl.js:584:18 at process._tickCallback (node.js:415:13)