【问题标题】:Unable to send parameters to SOAP method from Meteor's HTTP method无法从 Meteor 的 HTTP 方法向 SOAP 方法发送参数
【发布时间】:2015-03-27 16:02:12
【问题描述】:

我正在使用流星的http 包连接到通过 SOAP 消息进行通信的服务器。以下是代码(没有原始 url、命名空间、方法名和参数):

HTTP.call('POST', 'http://soap-service-url.com', { 身份验证:'用户:密码', 标题:{ SOAPTarget: 'http://soap-service-url.com', SOAPAction: 'http://required-namespace.com/methodName', “内容类型”:“文本/xml” }, 参数:{ 参数1:“参数值”, 参数2:'', }, 内容:'' + '' + '' + ' ' + '参数值' + ']]>' + ' ' + ' ' + '信封>' },函数(错误,结果){ 如果(错误){ console.log('发生错误..'); 控制台日志(错误); 返回; } 控制台.log(结果); console.log('----------'); });

当我调用不带参数的方法时,我可以获得预期的输出。但是当我用参数调用方法时,我得到了意想不到的输出。由于 content 属性中给出的参数没有传递,我添加了 params 属性,即使这样我也无法接收到预期的输出。为了测试这个问题,我创建了一个节点 js 应用程序并使用node-soap 模块连接到同一台服务器。我可以通过client.myMethod(args, callback[, options]) 上的args 传递参数并获得预期的结果。使用meteor的http包时如何传递参数?

【问题讨论】:

    标签: http soap meteor


    【解决方案1】:
    1. 要回答您的上述问题:将您的content xml 构建为http.call 之前的字符串,其中parameter1content 字符串中包含2 个值。

    2. 您上面的代码示例对我帮助很大,因为我无法让 node-soap 在 Meteor 中工作;总是得到Error: Cannot parse response - 谢谢 --我知道这是一篇旧帖子,您现在可能已经找到答案了。

    【讨论】:

      猜你喜欢
      • 2013-03-18
      • 2021-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-12
      • 2016-09-25
      • 1970-01-01
      • 2017-05-30
      相关资源
      最近更新 更多