如何在响应中添加肥皂头(NodeJS y Strong-soap)

问题描述 投票:0回答:1

我在node js中使用strong-soap作为服务器,我需要一个直通服务将xml转换为json(soap调用到rest调用,我使用asyn方法),但我需要使用带有标头的响应来响应soap传入请求。

我使用了文档提供的异步函数。

var myService = {
      MyService: {
          MyPort: {

              // This is how to define an asynchronous function, i can get the incoming headers but i dont send the response with headers.
              MyAsyncFunction: function(args, callback, headers) {
                  // do some work
                  callback({
                      name: args.name
                  });
              },

          }
      }
  };

传入的肥皂请求(正文和标头)-> 肥皂响应(正文和标题)<-

我该怎么做?

我正在寻找这个,但我什么也没找到。 我尝试向回调函数发送另一个参数

javascript node.js soap header strong-soap
1个回答
0
投票

得到的答复是... const 服务器=soap.listen(...);

const addResponseSoapHeaders = (headers: string | Object) => {
    //We need to clear previous headers (Headers in response will be accumulated from previous responses if we dont clear)
    server.clearSoapHeaders();
    //Add Headers to response
    server.addSoapHeader(headers);
}
© www.soinside.com 2019 - 2024. All rights reserved.