标签: cxf-codegen-plugin

Maven cxf插件错误

pom.xml当我添加apache cxf插件时,为什么我在文件中看到此错误?

生命周期配置未涵盖的插件执行:org.apache.cxf:cxf-codegen-plugin:2.5.4:wsdl2java(执行:generate-sources,阶段:generate-sources)

cxf maven-plugin pom.xml maven cxf-codegen-plugin

5
推荐指数
2
解决办法
5489
查看次数

让cxf-codegen-plugin在Java 9上运行

我一直试图让cxf-codegen-plugin在Java 9上运行一些阻力.到目前为止,我已经将java.se.ee添加到运行时模块中,并为maven添加了必要的依赖项.

但是,当我尝试构建我的源时,我收到以下错误:

DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://cxf.apache.org/tools/plugin", local:"databinding"). Expected elements are <{}databinding>,<{}frontend> 
 Location:  node: [databinding: null]
apr. 21, 2018 8:23:57 EM org.apache.cxf.tools.wsdlto.core.PluginLoader loadPlugin
ALLVARLIG: Tools plugin jar:file:/C:/Users/Daniel/.m2/repository/org/apache/cxf/cxf-tools-wsdlto-core/3.2.4/cxf-tools-wsdlto-core-3.2.4.jar!/META-INF/tools-plugin.xml load failed
Run Code Online (Sandbox Code Playgroud)

可能导致此问题或如何解决问题的任何想法?

cxf-codegen-plugin java-9

5
推荐指数
1
解决办法
1435
查看次数

wsdl2java - 如何忽略 cxf-codegen-plugin 中的特定模式并添加依赖项

见下文,我提到了 3 个项目。

Common
    Age.xsd (namespace: http://xmlns.common/age)
    generated/common/xmlns/age/AgeType.java
    pom.xml (cxf-xjc-plugin xsdtojava)


Person
    PersonService.wsdl (imports Age.xsd in wsd:types)
    generated/com/person/AgeType.java
    pom.xml (cxf-codegen-plugin wsdl2java)

Animal
    AnimalService.wsdl (imports Age.xsd in wsd:types)
    generated/com/animal/AgeType.java
    pom.xml (cxf-codegen-plugin wsdl2java)
Run Code Online (Sandbox Code Playgroud)

无论AnimalService.wsdlPersonService.wsdl进口Age.xsd架构所提到如下:

<wsdl:definitions xmlns:cn="http://xmlns.common/age"
<wsdl:types>
    <xsd:schema>
    <xsd:import
        namespace="http://xmlns.common/age"
         schemaLocation="classpath:/common/xmlns/age/Age.xsd" />
    </xsd:import>
    </xsd:schema>
     <!-- cn:AgeType used in output message -->
    <!-- ignored -->
    </wsdl:definitions>
Run Code Online (Sandbox Code Playgroud)

题:

如何分辨cxf-codegen wsdl2java不生成代码AgeType(在命名空间中的http://xmlns.common/age)和使用common.xmlns.age.AgeType代替com.person.AgeType和com.animal.AgeType在各自项目通过提供Common项目作为依赖?

java wsdl2java maven cxf-codegen-plugin

4
推荐指数
1
解决办法
6698
查看次数

如何使 CXF 生成的代码解组到 JAX-B 并忽略未映射的字段?

我调用一个网络服务,它可以定期在其合同中添加一些元素。

示例:SOAP 响应正文包含:

<picture>
   <active>true</active>
   <code>172</code>
   <label>Nikon D3200 Black</label>
   <downloadEnabled>true</downloadEnabled>
</picture>
<picture>
   <active>false</active>
   <code>177</code>
   <label>Nikon D5200 Red</label>
   <downloadEnabled>true</downloadEnabled>
   <extraField>none</extraField>
</picture>
Run Code Online (Sandbox Code Playgroud)

我的 CXF 生成的 JAXB Bean 如下所示:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "pictureListJAXB", propOrder = {
    "active",
    "code",
    "label",
    "downloadEnabled",
    "extraField"
})
public class PictureListJAXB {

    protected boolean active;
    protected String code;
    protected String label;
    protected boolean downloadEnabled;
    @XmlElement(nillable = true)
    protected String extraField

    // And Getters / Setters comes here after      

}
Run Code Online (Sandbox Code Playgroud)

JAXB bean 是使用 Maven 插件cxf-codegen-plugin版本 2.6.2(来自 apache.cxf)生成的。

现在我想知道是否有一个解决方案可以使我的 …

java cxf jaxb unmarshalling cxf-codegen-plugin

4
推荐指数
1
解决办法
5016
查看次数

wsdl 中的 CXF wsdl2java listwrapper 应解包

我目前正在将旧的轴 wsclient 更新为 cxf(jaxb 数据绑定)客户端,现在存在差异,如何list/array处理。

让我用一个例子来解释一下:

WSDL

<xsd:complexType name="ArrayOfString">
    <xsd:sequence>
        <xsd:element maxOccurs="unbounded" minOccurs="0" name="string" nillable="true" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)

这是另一个复杂类型

<xsd:complexType name="CustomParameter">
    <xsd:sequence>
        <xsd:element minOccurs="0" name="values" nillable="true" type="tns:ArrayOfString"/>
    </xsd:sequence>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)

现在,当尝试在 cxf 中访问此属性时,需要另外从列表包装器中获取值

CustomParameter.getValues().getString(); // returns List<String>
Run Code Online (Sandbox Code Playgroud)

Axis 确实会自动解开这个,因为您仅通过以下方式获得了数组

CustomParameter.getValues() // returns String[]
Run Code Online (Sandbox Code Playgroud)

我的问题是,在 cxf 中可以做到这一点吗?

我的 wsdl 的一部分:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws611.webservice.adapters.company.de" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws611.webservice.adapters.company.de" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://usermanagement.ws611.webservice.company.de"
                  xmlns:ns1="http://ws611.webservice.company.de" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws611.webservice.company.de">
            <xsd:complexType name="AuthenticationToken">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
                    <xsd:element …
Run Code Online (Sandbox Code Playgroud)

java cxf wsdl2java jaxb cxf-codegen-plugin

4
推荐指数
1
解决办法
5075
查看次数

跳过父项目中的 Maven 插件

我需要在父 pom 项目中跳过插件执行,但在子项目中执行它。这是怎么做到的?子项目在路径${basedir}/src/main/resources/${wsdl-name}.wsdl中使用 cxf-codegen-plugin 和 wsdl ,但父项目没有 wsdl 。

在父 pom.xml 中构建 => 插件

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/${wsdl-name}.wsdl</wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
                ...
        </plugins>
    </build>
Run Code Online (Sandbox Code Playgroud)

java maven-plugin pom.xml maven cxf-codegen-plugin

2
推荐指数
1
解决办法
247
查看次数

使用 Maven 和 cxf-codegen-plugin 在 JAR 中打包 WSDL 客户端

我有一个 Maven 项目,它将使用许多网络服务。该应用程序将被打包为 WAR。到目前为止,客户的代码已cxf-codegen-plugin在 ,generate-sources阶段生成。默认情况下,生成的源放置在 中target/generated-sources/cxf,之后compile,它们被编译并与 中的应用程序类混合target/classes。生成的类和应用程序类都可以共享第一级包。

我希望每个客户端都打包在WEB-INF/libWAR 文件中的自己的 JAR中。我发现了 about -clientjar,但它只生成.jar文件并将它们放入target/generated-sources/cxf,并且 JAR 也最终target/classes与编译的类一起出现,这是毫无意义的。

我想该compile插件在某个时候正在将生成的源编译为target/classes,并且可能另一个阶段也在将 JAR 移到那里。是否有可能让 Maven 避免编译那些生成的源代码(甚至根本不cxf-codegen-plugin生成源代码,只生成 JAR),并针对 CXF 生成的 JAR 编译应用程序类?

我知道可以通过为每个 Web 服务定义一个带有 jar 打包模块的多模块项目来实现这一点,但我想避免使用此选项。可能有大量的 Web 服务,不适合为每个服务维护一个独立的模块。随着-clientjar我已经被迫定义<wsdlOption>,以提供每个WSDL的JAR名为每个WSDL(这是不可能的,让cxf-codegen-plugin刚刚扫描src/main/resources/wsdl<wsdlRoot>)。

当然,客户端 JAR 可以在 Maven 之外生成并安装到本地存储库,并在项目中定义为依赖项,但我想知道是否可以在单个 Maven 构建中执行此操作。

对于程序集,我可能会整理出如何放置由-clientjarinto生成的 JAR 文件,WEB-INF/lib但在 …

java cxf webservice-client maven cxf-codegen-plugin

1
推荐指数
1
解决办法
8052
查看次数