我找到了解决方案。这很棘手,因为:
- 必须处理WSDL中内联的XSD。(技巧是schemaLocation =“ CP_Ablakido_1.wsdl#types1”。它告诉JAXB使用WSDL文件中的节点。)
- 必须配置CXF以使用XJC插件(annox)。
必须将以下片段添加到POM.XML:
<wsdlOption> <wsdl>${basedir}/src/main/resources/wsdl/CP_Ablakido_1.wsdl</wsdl> <bindingFiles> <bindingFile>${basedir}/src/main/resources/wsdl/CP_Ablakido_1.xjb</bindingFile> </bindingFiles> <extraargs><extraarg>-xjc-Xannotate</extraarg></extraargs></wsdlOption>
和依赖项必须添加到插件:
<dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics-annotate</artifactId> <version>0.6.0</version></dependency><dependency> <groupId>org.apache.cxf.xjcplugins</groupId> <artifactId>cxf-xjc-ts</artifactId> <version>3.0.5</version></dependency>
XJB文件:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:extensionBindingPrefixes="annox xjc" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:annox="http://annox.dev.java.net" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"> <jaxb:bindings schemaLocation="CP_Ablakido_1.wsdl#types1" node="/xs:schema"> <jaxb:bindings node="//xs:complexType[@name='InputMapping1']"> <annox:annotate target="class"> <annox:annotate annox: name="GetList_11"/> </annox:annotate> </jaxb:bindings> <jaxb:bindings node="//xs:complexType[@name='OutputMapping1']"> <annox:annotate target="class"> <annox:annotate annox: name="GetList_11Response"/> </annox:annotate> </jaxb:bindings> </jaxb:bindings></jaxb:bindings>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)