Web Services 如何使用JAX-WS和Maven生成SOAP 1.2版本端点

aelbi1ox  于 2022-11-15  发布在  Maven
关注(0)|答案(1)|浏览(194)

因此,我尝试使用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>

和绑定. 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,但没有成功。
无论如何有一个想法如何解决这个问题?如果需要更多的代码只是让我知道。提前感谢。

bzzcjhmw

bzzcjhmw1#

以下配置适合我:

<plugin>
            <groupId>com.helger.maven</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.6.1</version>
            <executions>
                <execution>
                    <id>periodictableaccessws</id>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <wsdlDirectory>src/main/resources</wsdlDirectory>
                        <wsdlFiles>
                            <wsdlFile>your_wsdl.wsdl</wsdlFile>
                        </wsdlFiles>
                        <packageName>your.target.package
                        </packageName>
                        <target>2.1</target>
                        <keep>true</keep>
                        <verbose>true</verbose>
                        <extension>true</extension>
                    </configuration>
                </execution>
            </executions>
        </plugin>

相关问题