我通过在更新到jaxws-maven-plugin 2.2时将Vivek
Pandey的方法调整为Maven
来解决了这个问题。我在此重申后代:
把这个XJB自定义文件(见下文),在默认绑定文件目录下,并设置wsimport的绑定,并http://www.w3.org/2001/XMLSchema.xsd。
XJB定制上面提到的XML文件xsd.xjb的内容应该在默认的绑定文件目录中,如下所示(贷方为Kohsuke):
聚甲醛<?xml version="1.0" encoding="UTF-8"?><bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" version="2.0"> <globalBindings> <xjc:simple /> </globalBindings> <bindings scd="~xsd:complexType"> <class name="ComplexTypeType"/> </bindings> <bindings scd="~xsd:simpleType"> <class name="SimpleTypeType"/> </bindings> <bindings scd="~xsd:group"> <class name="GroupType"/> </bindings> <bindings scd="~xsd:attributeGroup"> <class name="AttributeGroupType"/> </bindings> <bindings scd="~xsd:element"> <class name="ElementType"/> </bindings> <bindings scd="~xsd:attribute"> <class name="attributeType"/> </bindings></bindings>
这是我的POM文件的相关部分,并记录了更改:
<plugin> <!-- CHANGE: updated groupId and version --> <groupId>org.jvnet.jax-ws-commons</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal>wsimport</goal> </goals> <configuration> <!-- CHANGE: added args tag to bind http://www.w3.org/2001/XMLSchema.xsd --> <args> <arg>-b</arg><arg>http://www.w3.org/2001/XMLSchema.xsd</arg> </args> <wsdlFiles> <wsdlFile>erp-app-devel.srv.mycompany.ca/EgTestReportEngine/Service.asmx.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>http://erp-app-devel.srv.mycompany.ca/EgTestReportEngine/Service.asmx.wsdl</wsdlLocation> <staleFile>${project.build.directory}/jaxws/stale/Service.asmx.stale</staleFile> <!-- CHANGE: added bindingFiles tag to bind XJB customization, located at the default binding files directory, MyProject/src/jaxws/xsd.xjb . --> <bindingFiles> <bindingFile>xsd.xjb</bindingFile> </bindingFiles> </configuration> <id>wsimport-generate-egtestreportengine</id> <phase>generate-sources</phase> </execution> </executions> <dependencies> <dependency> <groupId>javax.xml</groupId> <artifactId>webservices-api</artifactId> <version>1.4</version> </dependency> </dependencies> <configuration> <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir> <xnocompile>true</xnocompile> <verbose>true</verbose> <extension>true</extension> <catalog>${basedir}/src/jax-ws-catalog.xml</catalog> <target>2.0</target> </configuration></plugin>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)