【问题标题】:SOAP-body auto generated namespaceSOAP-body 自动生成的命名空间
【发布时间】:2018-02-15 11:21:48
【问题描述】:

我必须对单功能 SOAP Web 服务进行一些支持,但我无法理解 WSDL 文件的特定方面以及由 SoapUI 生成的 SOAP 请求。

此服务的 WSDL 在定义部分 (targetNamespace="tetra-river-common-types/trafficinfo") 中指定了一个 targetNamespace。 如果我将 WSDL 文件加载到 SoapUI 中,它会完美地读取所有内容;任何定义都没有问题。此服务的类型在单个外部模式文件中定义,在 WSDL 文件中具有以下定义:

<wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="tetra-river-common-types" schemaLocation="tetra-river-interface.xsd" />
    </xsd:schema>
</wsdl:types>

但是,在将 WSDL 文件加载到 SoapUI 中并打开自动生成的请求后,它会显示以下内容:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tet="tetra-river-common-types">
   <soapenv:Header/>
   <soapenv:Body>
      <tet:TrafficInformation>
         <tet:Item1>?</tet:Item1>
         <!-- several other items with the tet: namespace prefixed -->
      </tet:TrafficInformation>
   </soapenv:Body>
</soapenv:Envelope>

我的问题是:tet: 命名空间是如何由 SoapUI 确定的?我在 WSDL 文件或 XSD 文件中都没有提到它。我假设它从 targetNamespace 获取前 3 个字符,但我不确定。 我面临的问题是 web 服务本身需要这个确切的消息,但 tetra: 作为命名空间。

【问题讨论】:

    标签: soap xsd soapui xml-namespaces


    【解决方案1】:

    如果您看到 wsdl,则有一个命名空间的导入,如下所示:

    namespace="tetra-river-common-types"
    

    如果您在soapUI 中看到请求,则第一行具有相同的命名空间,前缀为tet,即,

    xmlns:tet="tetra-river-common-types"
    

    因此,各个请求元素都以tet 为前缀。

    在引用同一个命名空间时,前缀是什么并不重要。

    有关命名空间的更多信息,请参阅here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-05
      • 2015-05-13
      • 1970-01-01
      • 2015-05-09
      • 2012-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多