2

我正在尝试使用 jaxws 生成我的 java 类。问题是我的绑定文件被忽略了。我在 bindingDirectory 中有两个绑定文件。也许有人可以帮忙?

    <profiles>

    <profile>
        <id>Generate model (POJOS) from wsdl</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>

        <build>
            <!-- JAX-WS provides a tool called wsimport which takes the WSDL of a 
                web service and generates proxy classes or the WSDL's service and port definitions. 
                These can then be used to access the web service endpoint. -->
            <plugins>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                        <artifactId>jaxws-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>Id1</id>
                                <goals>
                                    <goal>wsimport</goal>
                                </goals>
                                <configuration>
                                <wsdlUrls>
                                    <wsdlUrl>http://intan.local:8080/toa/ws/airService?wsdl</wsdlUrl>
                                </wsdlUrls>
                                <target>2.1</target>
                            <xjcArgs>
                                <xjcArg>-XautoNameResolution</xjcArg>
                            </xjcArgs>
                            <verbose>true</verbose>
                            <extension>true</extension>
                            <bindingFiles>
                                <bindingFile>src/main/resources/schemas/2011b/xjb/global.xjb</bindingFile>
                                <bindingFile>src/main/resources/schemas/2011b/xjb/TPA_ExtensionsType.xjb</bindingFile>
                            </bindingFiles>
                            <keep>true</keep>
                                    <packageName>gr.intan.toa._2011b</packageName>
                                    <sourceDestDir>src/main/generated</sourceDestDir>
                                <extension>true</extension>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                    <dependency>
                            <groupId>javax.xml</groupId>
                                <artifactId>webservices-api</artifactId>
                                <version>1.4</version>
                            </dependency>
                            <dependency>
                                <groupId>com.sun.xml.bind</groupId>
                                <artifactId>jaxb-xjc</artifactId>
                                <version>2.1.12</version>
                            </dependency>
                            <dependency>
                                <groupId>com.sun.xml.ws</groupId>
                                <artifactId>jaxws-rt</artifactId>
                                <version>2.1.4</version>
                            </dependency>
                    </dependencies>
                        <configuration>
                            <target>2.1</target>
                            <xjcArgs>
                                <xjcArg>-XautoNameResolution</xjcArg>
                            </xjcArgs>
                            <bindingDirectory>src/main/resources/schemas/2011b/xjb</bindingDirectory>
                            <keep>true</keep>
                        </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

提前致谢

4

1 回答 1

0

我认为 bindingDirectory 仅在显式配置 xjc 插件时才有效。您应该尝试 bindingFile 语义:

<configuration>
 <wsdlOptions>
  <wsdlOption>
   <wsdl>${basedir}/src/main/wsdl/myService.wsdl</wsdl>
   <bindingFiles>
    <bindingFile>${basedir}/src/main/resources/wsdl/async_binding.xml</bindingFile>
   </bindingFiles>
  </wsdlOption>
 </wsdlOptions>
</configuration>

http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html

于 2012-06-27T07:26:36.197 回答