如何使用JAX-WS和Maven生成SOAP 1.2 Version端点

时间:2014-01-06 17:16:46

标签: web-services maven soap wsdl jax-ws

所以我尝试使用带有JAX-WS的SOAP版本1.2来使用WSDL,但是它只会生成版本1.1。我正在使用Maven来使用WSDL。消耗WSDL的POM文件如下所示。

   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>1.10</version>

    <executions>
      <execution>
       <goals>
          <goal>wsimport</goal>
        </goals>
        <configuration>
          <wsdlFiles>
            <wsdlFile>MEAI_OnlineServices.webServices.Volubill_selfCare_04.wsdl</wsdlFile>
          </wsdlFiles>
          <bindingDirectory>${basedir}/src/wsdl</bindingDirectory>
          <extension>true</extension>
          <protocol>Xsoap1.2</protocol>            
        </configuration>
      </execution>

    </executions>

  </plugin>

以下是WSDL的片段

   <wsdl:definitions name="selfCare" targetNamespace="http://eaidev.mobinil.com/MEAI_OnlineServices/webServices/Volubill/selfCare" 
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
   xmlns:soapjms="http://www.w3.org/2008/07/soap/bindings/JMS/" 
   xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
   xmlns:tns="http://eaidev.mobinil.com/MEAI_OnlineServices/webServices/Volubill/selfC
   are" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
   xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">

然后在声明操作时,我有以下内容。

    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="deleteBucket">
  <soap12:operation soapAction="MEAI_OnlineServices_webServices_Volubill_selfCare_Binder_deleteBucket" style="document"/>
  <wsdl:input>
    <soap12:body parts="parameters" use="literal"/>
  </wsdl:input>
  <wsdl:output>
    <soap12:body parts="parameters" use="literal"/>
  </wsdl:output>
</wsdl:operation>

我无法让这个建筑成为1.2版本。我有2个绑定文件,如下所示,它们将阻止部分WSDL生成void方法而不是返回方法。

JAXB-binding.xml

   <?xml version="1.0" encoding="UTF-8"?>
   <!-- Prevent any Strings being changed to a JAXBE<String> element -->
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <jaxb:globalBindings generateElementProperty="false" />     
</jaxb:bindings>

并且bindings.xml

  <?xml version="1.0" encoding="UTF-8"?>
   <bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
wsdlLocation="MEAI_OnlineServices.webServices.Volubill_selfCare_04.wsdl"
xmlns="http://java.sun.com/xml/ns/jaxws">
<!-- Disable default wrapper style -->
<enableWrapperStyle>false</enableWrapperStyle>  
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
<endpoint binding="http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"/>
</endpoints>

绑定类中的端点试图让它生成SOAP 1.2,但我没有成功。

无论如何都知道如何解决这个问题?如果需要更多代码,请告诉我。提前谢谢。

0 个答案:

没有答案