node-soap是否可以在单个WSDL中处理具有不同名称空间的多个模式?

我正在使用node-soap与现有的SOAP API进行接口。 我遇到了多个模式和命名空间的问题,从我正在阅读的内容可能是一个已知的问题。 这里是设置,我用一个WSDL文件和两个模式进行交互:

WSDL(为简洁起见删除了属性和元素):

<wsdl:definitions xmlns:tns="[rm-nsurl]" targetNamespace="[rm-nsurl]" ...> <!-- schema1 --> <schema xmlns:tns="[cm-nsurl]" targetNamespace="[cm-nsurl]" ...> <complexType abstract="true" name="Operation"> <sequence> <element maxOccurs="1" minOccurs="0" name="operator" type="tns:Operator">...</element> </sequence> </<complexType </schema> <!-- schema2 --> <schema xmlns:cm="[cm-nsurl]" xmlns:tns="[rm-nsurl]" targetNamespace="[rm-nsurl]" ...> <complexType name="UserListOperation"> <complexContent> <extension base="cm:Operation">...</extension> </complexContent> </complexType> </schema> ... </wsdl:definitions> 

重要的细节是两个模式将tns定义为不同的值。 当schema2中的一个types引用了schema1( cm:Operation )中的一个元素时,它使用了cm的显式名称空间(目前为止还不错),但是随后跳转到schema1中的引用types中,我们现在看到了tns名称空间和schema1 tnscm 。 这会导致问题,因为node-soap对于tns使用单个整体值,在这种情况下恰好是rm并且在需要时不显式使用cm命名空间。

这里是我看到问题的一个例子:

请求对象传递给WSDL方法:

 { operations: [{ operator: 'SET', operand: { id: 'abcd1234', description: 'a description' } }] }; 

Node-soap生成的请求XML:

 <soap:Envelope xmlns:tns="[rm-nsurl]" xmlns:cm="[cm-nsurl]" ...> <soap:Body> <mutate xmlns="[rm-nsurl]"> <operations> <operator>SET</operator> <operand><id>abcd1234</id><description>a description</description></operand> </operations> </mutate> </soap:Body> </soap:Envelope> 

请求错误

 [OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0], RequiredError.REQUIRED @ operations[0].operator] 

我可以通过在自述文件中提到的在请求对象中手动包含operator元素的cm命名空间来解决此问题。 我想知道在这种情况下是否有更好的方式来使用node-soap,因为所有必需的信息都是在WSDL中指定的,或者我遇到了node-soap关于命名空间的一个扭曲问题?

这是与解决方法相同的请求对象:

 { operations: [{ 'cm:operator': 'SET', operand: { id: 'abcd1234', description: 'a description' } }] }; 

具体细节: 这是我正在使用的WSDL 。 我遇到了这个问题使用mutate操作,它是operator元素是错误地获取命名空间。