为什么一个wsdl有不同的请求定义

Why there are different request definition for one wsdl

在项目开始时,客户向我提供了一个 WSDL,我最终使用 SOAP UI 为给定的 WSDL 创建了一个请求和响应对象,其中请求对象如下所示,

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:def="http://DefaultNamespace">
   <soapenv:Header/>
   <soapenv:Body>
      <def:someOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">SOME_DATA</in0>
      </def:someOperation>
   </soapenv:Body>
</soapenv:Envelope>

但是当来自生产环境的实际请求对同一个 wsdl 是,

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <someOperation xmlns="urn:SOMEService">
    <in0>SOME_DATA</in0>
    </someOperation>
</soap:Body>
</soap:Envelope>

如果您观察到名称空间是相同的,但名称确实有所不同,例如在第一个请求中其 <soapenv:Envelope 而在第二个请求中相同的名称是 <soap:Envelope [=29 的每个节点中=],操作的定义在第一个请求中也是不同的,

<def:someOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">SOME_DATA</in0>
      </def:someOperation>

第二个是

<someOperation xmlns="urn:SOMEService">
    <in0>SOME_DATA</in0>
    </someOperation>

我不知道为什么解释不同,必须从第 1 位更改为第 2 位是否安全。 在这两种情况下,实际操作都很好,我对此没有任何问题,只是无法找出差异的原因。

有人可以帮助我解决这个问题,或者任何可以澄清我的疑问的文件的指导都很好。

it does has difference for names like in 1st request its <soapenv:Envelope and same in the 2nd request is <soap:Envelope in each node of xml

这里的soapenvsoapnamespace=http://schemas.xmlsoap.org/soap/envelope/local prefix names。因此,逻辑上两者是相同的,没有区别。

the definition of operation is also different in both the request in 1st v/s 2nd

如果是第一个,def:someOperation XML 个节点属于名称space = xmlns:def="http://DefaultNamespace"

而在第二种情况下,名称 space "urn:SOMEService" 直接定义为 XML Nodes 所以 如果 DefaultNamespaceSOMEService 完全相同,则表示 XML 操作 XML 相同。

因此, soapenv v/s soap 在你的情况下是一样的。

运算,可以根据SOMEServicev/sDefaultNamespace.

的实际值得出结论

希望对您有所帮助。