【发布时间】:2014-08-19 15:07:32
【问题描述】:
大家好,首先我想让你们看看我的 wsdl 文件,它是 DHL24 api,我想了解一下这方面的知识并使用简单的例子,这里是链接 https://dhl24.com.pl/webapi.html
我想使用 getVersion,如您所见,我们不需要为此提供任何数据,仅作为响应我们有 getVersionResult - STRING
首先,我使用简单项目创建了从 apache CTX 生成的包,这里是 POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.test</groupId>
<artifactId>DhlServiceClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<apache.cxf-version>2.5.9</apache.cxf-version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${apache.cxf-version}</version>
<executions>
<execution>
<id>Wsdl2Java - gasShopService.wsdl</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java/</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/dhlService.wsdl</wsdl>
<extraargs>
<extraarg>-client</extraarg>
<extraarg>-autoNameResolution</extraarg>
<extraarg>-p</extraarg>
<extraarg>pl.test</extraarg>
<extraarg>-aer=false</extraarg>
<extraarg>-verbose</extraarg>
<extraarg>-frontend</extraarg>
<extraarg>jaxws21</extraarg>
<extraarg>-wsdlLocation </extraarg>
<extraarg>classpath:dhlService.wsdl</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
这里一切都很好,我有包和类,所以我开始创建第二个项目(作为依赖项,我添加了这个包 - 这很好用)
现在我想创建简单的流程:
<flow name="getVersion" doc:name="getVersion">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8088" path="getVersion" doc:name="HTTP"/>
<logger doc:name="getVersion" message="Test Before" level="ERROR"/>
<cxf:jaxws-client operation="getVersion" clientClass="pl.test.integration.dhl.ws.client.DHL24WebapiService" port="DHL24WebapiPort" enableMuleSoapHeaders="true" doc:name="SOAP">
</cxf:jaxws-client>
<logger doc:name="getVersion" message="Test after" level="ERROR"/>
</flow>
没什么大不了的,但是当我发布到这里时,我有:
错误 2014-06-28 20:36:10,289 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor:错误前测试 2014-06-28 20:36:10,291 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: ****************************************************** ***************************** 消息:参数数量错误。路由失败 通过端点的事件:org.mule.module.cxf.CxfOutboundMessageProcessor。 消息负载的类型:ContentLengthInputStream 代码
: MULE_ERROR--2 -------------------------------------------------- ------------------------------ 异常堆栈是: 1. 参数数量错误(java.lang.IllegalArgumentException) sun.reflect.NativeMethodAccessorImpl:-2 (null) 2. 参数数量错误。无法通过端点路由事件:org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是 类型:ContentLengthInputStream (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 -------------------------------------------------- ------------------------------ 根异常堆栈跟踪:java.lang.IllegalArgumentException:错误 参数数量 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源) + 3 个以上(设置调试级别日志记录或 '-Dmule.verbose.exceptions=true' 为所有内容)
我在谷歌搜索了一下,发现了类似的东西。我在入站后添加:
<object-to-byte-array-transformer />
我还有其他错误:
错误 2014-06-28 20:45:18,149 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor:错误前测试 2014-06-28 20:45:18,151 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: ****************************************************** ***************************** 消息:参数数量错误。路由失败 通过端点的事件:org.mule.module.cxf.CxfOutboundMessageProcessor。 消息有效负载类型为:byte[] 代码: MULE_ERROR--2 -------------------------------------------------- ------------------------------ 异常堆栈是: 1. 参数数量错误(java.lang.IllegalArgumentException) sun.reflect.NativeMethodAccessorImpl:-2 (null) 2. 参数数量错误。无法通过端点路由事件:org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是 类型:byte[] (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 -------------------------------------------------- ------------------------------ 根异常堆栈跟踪:java.lang.IllegalArgumentException:错误 参数数量 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源) + 3 个以上(设置调试级别日志记录或 '-Dmule.verbose.exceptions=true' 为所有内容)
我需要一点点推这里它非常简单的方法,我不能正确处理它......
编辑后:
更改为您的流程:
<flow name="getVersion" doc:name="getVersion">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8088" path="getVersion" doc:name="HTTP"/>
<cxf:jaxws-client operation="getVersion" serviceClass="pl.test.integration.dhl.ws.client.DHL24WebapiService" port="DHL24WebapiPort" enableMuleSoapHeaders="true" doc:name="SOAP">
</cxf:jaxws-client>
<http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:8088/consumeTest" doc:name="HTTP" method="POST"/>
</flow>
<flow name="consumeTest" doc:name="consumeTest">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8088" path="consumeTest" doc:name="HTTP"/>
<logger doc:name="getVersion" message="Test AFTER" level="ERROR"/>
</flow>
答案是
没有这样的操作:getVersion。无法通过端点路由事件: org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是 类型:ContentLengthInputStream
当我使用 clientClass 而不是 serviceClass 时:
参数数量错误。无法通过端点路由事件: org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是 类型:ContentLengthInputStream
【问题讨论】:
标签: java web-services mule esb mule-studio