请求架构 -
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.G9.Request.com" xmlns:tns="http://www.G9.Request.com">
<xsd:complexType abstract="false" block="#all" final="#all" mixed="false" name="ProgramInterface">
响应架构 -
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.G9.Response.com" xmlns:tns="http://www.G9.Response.com">
<xsd:complexType abstract="false" block="#all" final="#all" mixed="false" name="ProgramInterface">
我正在使用maven-jaxb2-plugin插件来生成jaxb类。我希望在我的请求类中生成ProgramInterfaceInput
,在目标目录的ProgramInterfaceReponse
包中生成com.wsdl
作为我的响应类。
下面是我的POM和bindings.xjb内容 -
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<id>G9-schema-generate</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<schemas>
<schema>
<url>http://abc.xyzcorp.com:10000/ABC/G9?wsdl</url>
</schema>
</schemas>
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/bindings.xjb</bindingFile>
</bindingFiles>
<generateDirectory>${project.build.directory}/generated-sources/xjc2</generateDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
bindings.xjb
<jxb:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
version="2.1">
<jaxws:bindings wsdlLocation="http://abc.xyzcorp.com:10000/ABC/G9?wsdl">
<jaxws:bindings
node="//xsd:schema[@targetNamespace='http://www.G9.Request.com']/xsd:complexType[@name='ProgramInterface']">
<jxb:schemaBindings>
<jxb:package name="com.wsdl"/>
<jxb:nameXmlTransform>
<jxb:typeName suffix="Request"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jaxws:bindings>
<jaxws:bindings
node="//xsd:schema[@targetNamespace='http://www.G9.Response.com']/xsd:complexType[@name='ProgramInterface']">
<jxb:schemaBindings>
<jxb:package name="com.wsdl"/>
<jxb:nameXmlTransform>
<jxb:typeName suffix="Response"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jaxws:bindings>
</jaxws:bindings>
这不是给我想要的结果。它最终创建了两个包 -
com.request.g9 - ProgramInterface.java
com.response.g9 - ProgramInterface.java
我想要的是 -
com.wsdl - ProgramInterfaceRequest.java & ProgramInterfaceResponse.java
请建议。