Java MULE ESB—简单jaxws客户端don';不行…-消息负载的类型为:ContentLengthinInputStream
大家好,首先,我想让你们看看我的wsdl文件,它是DHL24API,我想了解一下这方面的知识,并使用简单的示例链接 我想使用getVersion,因为您可以看到,我们不需要为此提供任何数据,只需要响应getVersionResult-STRING即可 首先,我使用简单的项目创建了从apache CTX生成的包,这里是POM:Java MULE ESB—简单jaxws客户端don';不行…-消息负载的类型为:ContentLengthinInputStream,java,web-services,mule,esb,mule-studio,Java,Web Services,Mule,Esb,Mule Studio,大家好,首先,我想让你们看看我的wsdl文件,它是DHL24API,我想了解一下这方面的知识,并使用简单的示例链接 我想使用getVersion,因为您可以看到,我们不需要为此提供任何数据,只需要响应getVersionResult-STRING即可 首先,我使用简单的项目创建了从apache CTX生成的包,这里是POM: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/200
<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>
4.0.0
pl.试验
DhlServiceClient
0.0.1-快照
2.5.9
org.apache.cxf
cxf-codegen插件
${apache.cxf版本}
Wsdl2Java-gasShopService.wsdl
生成源
${basedir}/src/main/java/
${basedir}/src/main/resources/dhlService.wsdl
-客户
-自动命名解析
-p
pl.试验
-aer=错误
-冗长的
-前端
jaxws21
-wsdlLocation
类路径:dhlService.wsdl
wsdl2java
在这里一切都很好,我有包和类,所以我开始创建第二个项目(作为依赖项,我添加了这个包-这个很好用)
现在我想创建简单流程:
<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-2820:36:10289
[[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.defaultMessaginExceptionStrategy:
*********************************************************************************************************************************消息:参数数量错误。路由失败
通过端点的事件:org.mule.module.cxf.CxfOutboundMessageProcessor。
消息负载的类型为:ContentLengthinInputStream代码:MULE_错误--2 --------------------------------------------------------------------------------异常堆栈是: 1.参数数目错误(java.lang.IllegalArgumentException)sun.reflect.NativeMethodAccessorImpl:-2(null) 2.参数数量错误。无法通过终结点org.mule.module.cxf.CxfOutboundMessageProcessor路由事件。消息有效负载是 类型:ContentLengthinInputStream (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 --------------------------------------------------------------------------------根异常堆栈跟踪:java.lang.IllegalArgumentException:错误 上的参数数 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)位于 位于的sun.reflect.NativeMethodAccessorImpl.invoke(未知源) sun.reflect.DelegatingMethodAccessorImpl.invoke(未知源) +3个以上(为所有内容设置调试级别日志或“-Dmule.verbose.exceptions=true”)
我在谷歌搜索了一下,发现了类似的东西。我在入站后添加:
<object-to-byte-array-transformer />
我还有其他错误:
错误2014-06-2820:45:18149
[[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.defaultMessaginExceptionStrategy:
*********************************************************************************************************************************消息:参数数量错误。路由失败
通过端点的事件:org.mule.module.cxf.CxfOutboundMessageProcessor。
消息有效负载的类型为:byte[]代码:
MULE_错误--2
--------------------------------------------------------------------------------异常堆栈是:
1.参数数目错误(java.lang.IllegalArgumentException)sun.reflect.NativeMethodAccessorImpl:-2(null)
2.参数数量错误。无法通过终结点org.mule.module.cxf.CxfOutboundMessageProcessor路由事件。消息有效负载是
类型:字节[](org.mule.api.transport.DispatchException)org.mule.module.cxf.CxfOutboundMessageProcessor:150 --------------------------------------------------------------------------------根异常堆栈跟踪:java.lang.IllegalArgumentException:错误 上的参数数 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)位于 位于的sun.reflect.NativeMethodAccessorImpl.invoke(未知源) 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>
<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。消息有效负载是
类型:ContentLengthinInputStream
当我使用clientClass而不是serviceClass时:
参数数量错误。无法通过终结点路由事件:
org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是
类型:ContentLengthinInputStream
你需要放一个ou
<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.execon.integration.dhl.ws.client.DHL24WebapiService" port="DHL24WebapiPort" enableMuleSoapHeaders="true" doc:name="SOAP">
</cxf:jaxws-client>
<http:outbound-endpoint exchange-pattern="request-response" address="Your external webservice path that you are tying to consume " doc:name="HTTP" method="POST"/>
</flow>
<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>