如何在 pom.xml 中同时定义 wsdl url 和 xsd 位置

问题描述

在我的项目中,我有一个肥皂生产者,这个生产者的类是使用定义的 xsd 文件生成的。我的要求是在同一项目中定义一个soap客户端,该项目使用给定soap服务器的wsdl url访问不同的soap服务器。如何在我的 pom.xml 中指定 wsdl url 和 xsd 架构?这是我的pom

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>2.5.0</version>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sources>
                        <source>${project.basedir}/src/main/resources/transaction.xsd
                        </source>
                    </sources>
                </configuration>
            </plugin>
<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/jaxb</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

<plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.14.0</version>
                <executions>
                    <execution>
                        <id>schema1-generate</id>
                        <?m2e execute onConfiguration?>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <schemaLanguage>WSDL</schemaLanguage>

                            <generatePackage>mx.com.billing1
                            </generatePackage>
                    
                            <schemas>
                                <schema>
                                    <url>http://test.asmx?wsdl
                                    </url>
                                </schema>
                            </schemas>
                        </configuration>
                    </execution>
                    
                </executions>
            </plugin>

但问题是,xsd 文件生成类也被添加到为 wsdl 生成文件定义的包中,即 mx.com.billing1 的包在 transaction.xsd 文件中定义了类。我如何在 pom.xml 中定义 wsdl url 和 xsd 位置?请指导我正确的 pom 结构。

解决方法

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

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

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