Tag: 节点 肥皂

我如何强制命名空间前缀使用?

我想消费一个SOAP Web服务,但WSDL是有点破,所以我必须做一些定制node-soap 。 我想要的理想SOAP信封就是这个: <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Body> <getImagesDefinition xmlns="http://services.example.com/"/> </Body> </Envelope> 到目前为止,这是我必须调用服务的nodejs代码: var soap = require('soap'); var url = 'http://www.example.com/services/imagesizes?wsdl'; soap.createClient(url, function(err, client) { client.setEndpoint('http://www.example.com/services/imagesizes'); client.getImagesDefinition(null, function(err, result) { console.log(result); }); console.log(client.lastRequest) }); 我必须手动设置端点,因为它在WSDL文件中被破坏 打印client.lastRequest得到的信封是这样的: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://services.example.com/"> <soap:Body> <getImagesDefinition /> </soap:Body> </soap:Envelope> 我知道,如果我可以强制命名空间前缀的身体有<tns:getImagesDefinition />而不是<getImagesDefinition />请求完美的作品。 有什么办法强迫我? 我读了文档,说tns是一个默认的忽略命名空间,所以我试图通过这样做来改变: var options = { ignoredNamespaces: { […]