How to see request and response data in node soap?

泪湿孤枕 提交于 2019-12-10 15:55:45

问题


I am trying to consume a soap api using node soap. My response cannot be parsed and I wonder how to see the request and response data to console to ease the error finding process.


回答1:


As node soap uses the request library, one can debug it via:

NODE_DEBUG=request node src/index.js

as pointed out request's Readme.md:

Debugging

There are at least three ways to debug the operation of request:

  1. Launch the node process like NODE_DEBUG=request node script.js (lib,request,otherlib works too).

  2. Set require('request').debug = true at any time (this does the same thing as #1).

  3. Use the request-debug module to view request and response headers and bodies.




回答2:


To see the generated SOAP XML request you can use this:

Client.lastRequest - the property that contains last full soap request for client logging



来源:https://stackoverflow.com/questions/39486567/how-to-see-request-and-response-data-in-node-soap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!