Node.js 中的 SOAP

发布于 2024-11-16 05:34:56 字数 9008 浏览 5 评论 0原文

当然,您会告诉我 SOAP 已被弃用,而且我被迫使用它。

现在,我尝试使用 doouche 模块(https://github.com/marcgreenstock/douche)但当我这样做时它失败了(WSDL url 很好,事实上我正在尝试 test/index.js 中提供的示例)

Client.wsdl.parse(function(wsdl) {
  console.log(wsdl);
});

错误是:

/usr/local/lib/node_modules/douche/lib/douche/wsdl.js:74
  attrs.forEach(function(url,index) {
        ^
TypeError: Object #<Object> has no method 'forEach'
    at [object Object]._read_namespaces (/usr/local/lib/node_modules/douche/lib/douche/wsdl.js:74:9)
    at /usr/local/lib/node_modules/douche/lib/douche/wsdl.js:20:10
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/douche/lib/douche/wsdl.js:102:7)
    at IncomingMessage.emit (events.js:81:20)
    at HTTPParser.onMessageComplete (http.js:133:23)
    at Socket.ondata (http.js:1226:22)
    at Socket._onReadable (net.js:683:27)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

关于肥皂(https://github.com/milewise/node-soap)我什至无法使用 NPM 安装它,它失败了:

> [email protected] install /home/warorface/node_modules/soap/node_modules/node-expat
> node-waf configure build

> [email protected] preinstall /home/warorface/node_modules/soap/node_modules/compress
> node-waf configure build

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.127s)
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Waf: Entering directory `/home/warorface/node_modules/soap/node_modules/node-expat/build'
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
[1/2] cxx: node-expat.cc -> build/default/node-expat_1.o
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
../node-expat.cc:6:19: fatal error: expat.h: No existe el fichero o el directorio
compilation terminated.
Waf: Leaving directory `/home/warorface/node_modules/soap/node_modules/node-expat/build'
Build failed:  -> task failed (err #1): 
    {task: cxx node-expat.cc -> node-expat_1.o}
Checking for gcc                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for library z                   : npm ERR! error installing [email protected] Error: [email protected] install: `node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected]     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! error installing [email protected] Error: [email protected] install: `node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected]     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! [email protected] install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Linux 2.6.38-8-generic-pae
npm ERR! command "node" "/usr/local/bin/npm" "install" "soap"
Traceback (most recent call last):
  File "/usr/local/bin/node-waf", line 16, in <module>
    Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
    prepare_impl(t, cwd, ver, wafdir)
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
    main()
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
    fun(ctx)
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 241, in configure
    conf.sub_config([''])
  File "/usr/local/bin/../lib/node/wafadmin/Configure.py", line 221, in sub_config
    self.recurse(k, name='configure')
  File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 634, in recurse
    f(self)
  File "/home/warorface/node_modules/soap/node_modules/compress/wscript", line 18, in configure
  File "/usr/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 444, in check
    ret = self.run_c_code(*k, **kw)
  File "/usr/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 530, in run_c_code
    bld.compile()
  File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 292, in compile
    os.chdir(back)
OSError: [Errno 2] No such file or directory: '/home/warorface/node_modules/soap/node_modules/compress/build/.conf_check_0'
npm ERR! error installing [email protected] Error: [email protected] preinstall: `node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected]     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! 

Sure, you're gonna tell me that SOAP is deprecated and all, well I'm forced to use it.

Now, I've tried with the douche module (https://github.com/marcgreenstock/douche) but it fails when I do this (the WSDL url is fine, in fact I'm trying the provided example at test/index.js)

Client.wsdl.parse(function(wsdl) {
  console.log(wsdl);
});

The error is:

/usr/local/lib/node_modules/douche/lib/douche/wsdl.js:74
  attrs.forEach(function(url,index) {
        ^
TypeError: Object #<Object> has no method 'forEach'
    at [object Object]._read_namespaces (/usr/local/lib/node_modules/douche/lib/douche/wsdl.js:74:9)
    at /usr/local/lib/node_modules/douche/lib/douche/wsdl.js:20:10
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/douche/lib/douche/wsdl.js:102:7)
    at IncomingMessage.emit (events.js:81:20)
    at HTTPParser.onMessageComplete (http.js:133:23)
    at Socket.ondata (http.js:1226:22)
    at Socket._onReadable (net.js:683:27)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

About soap (https://github.com/milewise/node-soap) I can't even install it with NPM, it fails:

> [email protected] install /home/warorface/node_modules/soap/node_modules/node-expat
> node-waf configure build

> [email protected] preinstall /home/warorface/node_modules/soap/node_modules/compress
> node-waf configure build

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.127s)
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Waf: Entering directory `/home/warorface/node_modules/soap/node_modules/node-expat/build'
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
[1/2] cxx: node-expat.cc -> build/default/node-expat_1.o
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
../node-expat.cc:6:19: fatal error: expat.h: No existe el fichero o el directorio
compilation terminated.
Waf: Leaving directory `/home/warorface/node_modules/soap/node_modules/node-expat/build'
Build failed:  -> task failed (err #1): 
    {task: cxx node-expat.cc -> node-expat_1.o}
Checking for gcc                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for library z                   : npm ERR! error installing [email protected] Error: [email protected] install: `node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected]     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! error installing [email protected] Error: [email protected] install: `node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected]     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! [email protected] install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Linux 2.6.38-8-generic-pae
npm ERR! command "node" "/usr/local/bin/npm" "install" "soap"
Traceback (most recent call last):
  File "/usr/local/bin/node-waf", line 16, in <module>
    Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
    prepare_impl(t, cwd, ver, wafdir)
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
    main()
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
    fun(ctx)
  File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 241, in configure
    conf.sub_config([''])
  File "/usr/local/bin/../lib/node/wafadmin/Configure.py", line 221, in sub_config
    self.recurse(k, name='configure')
  File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 634, in recurse
    f(self)
  File "/home/warorface/node_modules/soap/node_modules/compress/wscript", line 18, in configure
  File "/usr/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 444, in check
    ret = self.run_c_code(*k, **kw)
  File "/usr/local/bin/../lib/node/wafadmin/Tools/config_c.py", line 530, in run_c_code
    bld.compile()
  File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 292, in compile
    os.chdir(back)
OSError: [Errno 2] No such file or directory: '/home/warorface/node_modules/soap/node_modules/compress/build/.conf_check_0'
npm ERR! error installing [email protected] Error: [email protected] preinstall: `node-waf configure build`
npm ERR! error installing [email protected] `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing [email protected]     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected]     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected]     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请止步禁区 2024-11-23 05:34:56

修复了该问题并在 github 上分叉了 marcgreenstock/douche 存储库:

https://github.com/kr1sp1n/douche

安装我的自定义冲洗器:

  1. git clone [电子邮件受保护]:kr1sp1n/douche.git
  2. cd douche
  3. npm link
  4. cd /path/to/your/project
  5. npm uninstall douche
  6. npm link douche

就是这样!

Fixed that issue and forked the marcgreenstock/douche repository on github:

https://github.com/kr1sp1n/douche

Install my customized douche:

  1. git clone [email protected]:kr1sp1n/douche.git
  2. cd douche
  3. npm link
  4. cd /path/to/your/project
  5. npm uninstall douche
  6. npm link douche

That's it!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文