【问题标题】:Should WSDL have unique namespace for each schemaWSDL 是否应该为每个模式提供唯一的命名空间
【发布时间】:2016-09-08 07:28:10
【问题描述】:

是否要求每个模式必须在 wsdl 中具有唯一的命名空间? 例如,考虑下面的 WSDL sn-p,它没有模式的命名空间。

<wsdl:types>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="GetFilterValuesRequest.xsd"/>
 </xsd:schema>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="GetFilterValuesReply.xsd"/>
 </xsd:schema>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="IRequest.xsd"/>
 </xsd:schema>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="IReply.xsd"/>
 </xsd:schema>
</wsdl:types>

我问的原因是,我正在使用node-soap 库来编写 WSDL 服务,并且当架构中存在冲突的命名空间或根本没有命名空间时,该库服务不起作用。

当发送 SOAP 请求时,它会给出错误消息 Cannot read property 'input' of undefined,因为它会按名称空间构建模式映射,然后无法找到给定请求的唯一模式。

我不想详细介绍错误或其修复,但是,我想了解 WSDL 是否需要它才能成为有效的?

【问题讨论】:

    标签: soap wsdl node-soap


    【解决方案1】:

    是的,SOAP 服务器需要命名空间才能与大多数客户端正常运行。

    您的架构都在同一个命名空间中,因此如果您定义了同名的数据结构,这将是一个问题。

    XML 中的命名空间就像编程语言中的命名空间。它们防止同名的数据类型相互冲突。

    请注意,命名空间不必是 URL。那只是一个约定。它可以是任何东西,它只需要是独一无二的。

    【讨论】:

      猜你喜欢
      • 2011-07-18
      • 1970-01-01
      • 2021-11-24
      • 2012-08-20
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-11
      相关资源
      最近更新 更多