SOAP node returns error Target-Namespace “undefined” already in use by another Schema

前端 未结 4 2076
無奈伤痛
無奈伤痛 2020-12-31 22:43

I\'m trying to write a client for russian post to get track. It uses SOAP WSDL. I\'m to get at least client object.

 \'use strict\'
let soap=require(\'soap\         


        
4条回答
  •  耶瑟儿~
    2020-12-31 23:22

    While the above top solution does work, it's a poor solution since it defeats the whole purpose of WSDLs. SoapUI works fine with the service I'm using and this tool should be able to as well.

    I ended up solving this by updating the node-soap code in node_modules\soap\lib\wsdl\elements.js by adding the following lines after line 826: var targetNamespace = child.$targetNamespace;:

    if (!targetNamespace && child.includes && child.includes.length === 1) {
        targetNamespace = child.includes[0].namespace;
    }
    

    This works if you have a schema element where the only child is an import element (see example below). May try to get a PR approved if the maintainer is up for it.

    Example:

    
      
        
      
      
        
      
    
    

    See git repo for original TS code: https://github.com/.../node-soap/.../elements.ts#L826

提交回复
热议问题