大家好我首先要求你看看我的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>
没有什么大事,但是当我发帖到这里时我有:
ERROR 2014-06-28 20:36:10,289 [[gaspoldhlservice] .connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor:在ERROR之前测试 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。消息有效负载是 type:ContentLengthInputStream (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 -------------------------------------------------- ------------------------------ Root异常堆栈跟踪:java.lang.IllegalArgumentException:错误 参数的数量 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)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:在ERROR之前测试 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。消息有效负载是 type:byte [](org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 -------------------------------------------------- ------------------------------ Root异常堆栈跟踪:java.lang.IllegalArgumentException:错误 参数的数量 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)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。消息有效负载是 type:ContentLengthInputStream
当我使用clientClass而不是serviceClass:
时错误的参数数量。无法通过端点路由事件: org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是 type:ContentLengthInputStream
答案 0 :(得分:0)
您需要在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"/>
将值发布到外部Web服务..
例如,如果您的外部Web服务位于http://localhost:8086/mainData?wsdl
,那么您需要输入
<http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:8086/mainData" doc:name="HTTP" method="POST"/>
................还有一件事......你能不能改变
<cxf:jaxws-client operation="getVersion" clientClass="pl.execon.integration.dhl.ws.client.DHL24WebapiService" port="DHL24WebapiPort" enableMuleSoapHeaders="true" doc:name="SOAP">
到
`<cxf:jaxws-client operation="getVersion" serviceClass="pl.execon.integration.dhl.ws.client.DHL24WebapiService" port="DHL24WebapiPort" enableMuleSoapHeaders="true" doc:name="SOAP">` in your flow and try ...
所以最终流程会是这样的: -
<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>
答案 1 :(得分:0)
编辑后:
更改为您的流程:
<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。消息有效负载是 type:ContentLengthInputStream
当我使用clientClass而不是serviceClass:
时错误的参数数量。无法通过端点路由事件: org.mule.module.cxf.CxfOutboundMessageProcessor。消息有效负载是 type:ContentLengthInputStream