如何使用Spring-WS在包络中创建具有多个元素的SOAP Web服务?

时间:2016-01-12 07:24:24

标签: java spring soap xsd wsdl

我有一个"硬编码" Web服务客户端,我需要创建具有指定XML结构的WS,它在SOAUP UI中查找:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:din="http://try.com/2010/webservice/Service">
  <soapenv:Header/>
  <soapenv:Body>
    <sin:AuthData>
       <!-- items -->
    </sin:AuthData>
    <sin:equestData>
      <!-- items -->
    </sin:RequestData>
  </soapenv:Body>
</soapenv:Envelope>

有两个根元素AuthData和RequestData。 Spring-WS从XSD生成WSDL。我有一个问题:

是否可以从XSD生成类似于上述结构的SOAP信封?

如何更正XSD以获得上述SOAP env结构?

现在我的XSD看起来像:

enter image description here

我收到了下一个错误的(对我来说)SOAP env结构:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pow="http://comp.com.ru/pow">
   <soapenv:Header/>
   <soapenv:Body>
      <pow:processRequestRequest>
         <pow:authData>
          <!-- items -->
         </pow:authData>
         <pow:processRequestData>
          <!-- items -->
         </pow:processRequestData>
      </pow:processRequestRequest>
   </soapenv:Body>
</soapenv:Envelope>

通常我需要将authDataRequestData元素提升到一级(或删除processRequestRequest元素)。

  

Spring WS仅提供&#34;&#34;契约优先,从XSD架构开始

这是否意味着我应该拒绝在我的情况下使用Spring-Ws?

0 个答案:

没有答案