使用 WSDL 创建特定的 SOAP XML 消息

问题描述

我试图了解 WSDL 的工作原理以及如何创建 WSDL。基本上,我的问题是我想创建一个具有特定 XML 结构的请求。 这是我要更改的 XML 部分:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://www.kba.de/coc" 
   elementFormDefault="qualified" 
   attributeFormDefault="unqualified">
  <xs:element name="coc-mitteilung">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="InitialVehicleinformation">
              <xs:complexType>
                 <xs:sequence>
                     <xs:element name="firstname" type="xs:string"/>
                    <xs:element name="lastname" type="xs:string"/>
                    <xs:element name="address" type="xs:string"/>
                 </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

SoapUI 中的结果请求格式如下:

<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:coc="http://www.kba.de/coc">
<soapenv:Header/>
<soapenv:Body>
  <coc:coc-mitteilung>
     <coc:InitialVehicleinformation>
        <coc:firstname>Name</coc:firstname>
        <coc:lastname>Surname</coc:lastname>
        <coc:address>Address</coc:address>
     </coc:InitialVehicleinformation>
  </coc:coc-mitteilung>
</soapenv:Body>
</soapenv:Envelope>

但我想要实现的是以下 XML:

<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:coc="http://www.kba.de/coc">
<soapenv:Header/>
<soapenv:Body>
  <coc:coc-mitteilung>
     <InitialVehicleinformation>
        <firstname>Name</firstname>
        <lastname>Surname</lastname>
        <address>Address<address>
     </InitialVehicleinformation>
  </coc:coc-mitteilung>
</soapenv:Body>
</soapenv:Envelope>

所以从级别 InitialVehicleinformation 来看,我不想在生成的请求中指定 coc 前缀。可能吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)