标签: wsdl2java

为什么CXF WSDLToJava的Ant/Ivy集成不起作用?

我想使用WSDLToJavaApache的CXF在我的Ant构建文件从WSDL创建Java代码.使用Ivy解决依赖关系.我总是得到以下错误:

WSDLToJava Error: Could not find jaxb databinding within classpath
Run Code Online (Sandbox Code Playgroud)

我没有安装,想用Ivy为我做这个工作.这是我的Ant构建文件的一部分:

<target name="generate" depends="init">
  <ivy:retrieve conf="build"/>
  <mkdir dir="${basedir}/target/generated"/>
  <ivy:cachepath pathid="build-classpath" conf="build"/>
  <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
    <arg value="-d"/>
    <arg value="${basedir}/target/generated"/>
    <arg value="-client"/>
    <arg value="${basedir}/src/schema/MyWebService.wsdl"/>
    <classpath refid="build-classpath"/>
  </java>
</target>
Run Code Online (Sandbox Code Playgroud)

我使用Java 6,Ant 1.8,Ivy 2.2.0 ant CXF 2.2.12.在常春藤模块中,我配置了以下内容:

<configurations>
  <conf name="build" visibility="private"/>
  ...
</configurations>

<dependencies defaultconfmapping="*->default">
  <dependency org="org.apache.cxf" name="cxf-tools-wsdlto-frontend-jaxws" rev="2.2.12" conf="build"/>
  <dependency org="org.apache.cxf" name="cxf-rt-databinding-jaxb" rev="2.2.12" conf="build"/>
  ...
</dependencies>
Run Code Online (Sandbox Code Playgroud)

问题出在哪儿?也许有一个依赖缺失,但哪一个?如果没有Ivy,Ant集成将使用包含CXF安装的所有jar的类路径.如果我这样做,它的确有效.

在构建的输出中,我看到以下内容:

generate (2s)
[generate] ivy:retrieve (1s)
[ivy:retrieve] :: …
Run Code Online (Sandbox Code Playgroud)

java ant cxf wsdl2java ivy

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

从类加载器看不到接口

我是新手!框架和使用wsdl2java工具.我正在开发一个游戏!需要与SOAP Web服务交互的应用程序.我有WSDL并使用jaxws从中创建对象.它正在创建一堆java类和1个接口.一旦我尝试进行webservice调用,我就会收到类加载器无法找到接口的错误.这是我的代码:

MyWebserviceBeanService service = new MyWebserviceBeanService();
MyWebserviceRemote mwr = service.getMyWebserviceBeanPort();
LoginResponse response = mwr.loginUser("xxx", "xxx");
Run Code Online (Sandbox Code Playgroud)

请注意,'MyWebserviceRemote'是接口.代码getMyWebserviceBeanPort很常见,因为它是自动生成的,但它是:

@WebEndpoint(name = "MyWebserviceBeanPort")
public MyWebserviceRemote getMyWebserviceBeanPort() {
    return super.getPort(new QName("http://xxxxxxxxxx/", "MyWebserviceBeanPort"), MyWebserviceRemote.class);
}
Run Code Online (Sandbox Code Playgroud)

当我尝试调用方法时,例如loginUser上面的方法,我得到以下stacktrace:

play.exceptions.JavaExecutionException: interface xxxx.xxxx.xxxx.MyWebserviceRemote is not visible from class loader
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalArgumentException: interface xxxx.xxxxx.xxxx.MyWebserviceRemote is not visible from class loader
    at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:736)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:408)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:384)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:366)
    at javax.xml.ws.Service.getPort(Service.java:119)
    at xxxx.xxxx.xxxx.MyWebserviceBeanService.getMyWebserviceBeanPort(MyWebserviceBeanService.java:72)
    at controllers.MyController.index(MyController.java:26)
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484) …
Run Code Online (Sandbox Code Playgroud)

wsdl2java classloader playframework

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

从 WSDL 创建 Java 类

我正在尝试使用 maven cxf-codegen-plugin 从 WSDL 创建一个 Java 类,但是当我尝试这样做时,它只显示一个错误并且没有生成类。

我不明白为什么我有这个错误,我的 pom 文件看起来不错。

我的pom.xml样子

 <dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.7.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http-hc</artifactId>
        <version>2.7.3</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-bundle</artifactId>
        <version>2.5.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration> …
Run Code Online (Sandbox Code Playgroud)

java cxf wsdl2java jaxb maven

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

Axis2 1.7.1 wsdl2java 问题

wsdl2java -u -uri在 wsdl 文件和它生成的 java 类上运行引发错误xxx must implement the inherited abstract method adbbean.getpullparser。我想我以前没有遇到过这个问题。

这是为什么?

axis2 wsdl2java

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

在pom.xml中指定wsdl url并将wsdl jar下载到本地计算机

这是一个wsdl服务链接:http://www.webservicemart.com/uszip.asmx? WSDL

如果我运行以下命令:

wsimport -s src -d bin http://www.webservicemart.com/uszip.asmx?WSDL

此命令在/ src目录中生成Java源代码,并在/ bin目录中生成相对于发出命令的目录的已编译.class文件.这些生成的类可用于访问远程Web服务.

通过发出以下命令,创建了一个jar文件zipws.jar,其中包含com.webservicemart.ws包中的类:

  • cd/bin
  • jar cvf zipws.jar com

我可以将这个jar添加到java项目的构建路径中并使用它.

有没有办法让我可以用maven2创建一个java项目,并在POM.xml中指定这个wsdl url并将jar直接下载到我的本地机器中?如果您需要更多信息,请与我们联系.

java wsdl web-services wsdl2java maven

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

WSDL2Java故障-嵌套内容

我正在尝试使用Axis2 wsdl2java从一大套模式(总共15k行)生成Java存根,并且遇到以下复杂类型的问题。最初在架构文件上运行该工具时,我收到了一条非描述性的错误消息,“不支持的内容简单内容!”。为了找到此错误的原因,我从源代码下载并部署了Axis2项目,找到了错误字符串并检查了引起问题的元素。我相信问题的根源与在简单内容内嵌套具有简单内容的复杂类型有关。

我有两个示例,分别是SequencedTextType(失败)和OpenTextType(成功)。两种类型都具有作为TextType扩展名的内容。这样应该可以更容易地发现问题并提供解释。

故障 SequencedTextType:

<xs:element name="Reason" type="SequencedTextType" id="oagis-id-fa892eb1e28c46088bc50394c62a8655"/>

<xs:complexType name="SequencedTextType" id="oagis-id-51e010d7a1e24ebe89fcf58989fefd1b">
    <xs:complexContent>
        <xs:extension base="TextType">
            <xs:attribute name="sequenceNumber" type="NumberType_B98233" id="oagis-id-39a5a53826024a65a2291f50d9feecd3"/>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>

<xs:simpleType name="NumberType_B98233" id="oagis-id-d614ed8726ff482c9c5a8183d735d9ed">
    <xs:restriction base="xs:integer"/>
</xs:simpleType>
Run Code Online (Sandbox Code Playgroud)

路过 OpenTextType:

<xs:complexType name="OpenTextType" id="oagis-id-5840f7a57dd949ababcd1eb394b2840c">
    <xs:simpleContent>
        <xs:extension base="TextType">
            <xs:attribute name="typeCode" type="CodeType_1E7368" id="oagis-id-2780e69800934662a4782be31c2bacf6"
                          use="optional"/>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:simpleType name="CodeType_1E7368" id="oagis-id-d2f721a297684b538e7dbb88cf5526bc">
    <xs:restriction base="xs:token"/>
</xs:simpleType>
Run Code Online (Sandbox Code Playgroud)

共享 TextType:

<xs:complexType name="TextType" id="oagis-id-d97b8cf6a26f408db148163485796d15">
    <xs:simpleContent>
        <xs:extension base="TextType_62S0B4"/>
    </xs:simpleContent>
</xs:complexType>

<xs:complexType name="TextType_62S0B4" id="oagis-id-89be97039be04d6f9cfda107d75926b4">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="languageCode" type="clm56392A20081107_LanguageCodeContentType" id="oagis-id-c8d0c7094d7d4fbeb7e50fd20a17c1b3" use="optional"/>
        </xs:extension>
    </xs:simpleContent> …
Run Code Online (Sandbox Code Playgroud)

xsd axis2 cxf wsdl2java

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

标签 统计

wsdl2java ×6

cxf ×3

java ×3

axis2 ×2

maven ×2

ant ×1

classloader ×1

ivy ×1

jaxb ×1

playframework ×1

web-services ×1

wsdl ×1

xsd ×1