MULE ESB-简单的Jaxws客户端不起作用...-消息有效载荷的类型为:ContentLengthInputStream [英] MULE ESB - simple jaxws client don't work ... - Message payload is of type: ContentLengthInputStream

查看:102
本文介绍了MULE ESB-简单的Jaxws客户端不起作用...-消息有效载荷的类型为:ContentLengthInputStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,首先我想让您看到我的wsdl文件,它是DHL24 api,我想对此学习一点,并使用简单的示例,这里是链接

Hi guys first of all I want you to see my wsdl file it's DHL24 api I want learn a bit on this and use simple example here is the link https://dhl24.com.pl/webapi.html

我想使用 getVersion ,因为您看到我们不需要为此提供任何数据,只是因为我们有 getVersionResult -STRING

I want to use getVersion as you can see we don't need to provide any data to this only in response we have getVersionResult - STRING

首先,我使用以下简单项目创建了从apache CTX生成的程序包:POM:

First of all I created package generated from apache CTX using simple project here is 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>

这里一切都很好,我有程序包和类,所以我开始创建第二个项目(因为我添加了此程序包的依赖项,所以效果很好)

All is fine here I have package and classes so I start to create second project (as dependency I added this package - this works fine)

现在,我想创建简单的流程:

Now I want to create simple flow:

<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>

没什么大不了的,但是当我发布到这篇文章时,我有:

Nothing big but when I post to this I have:

错误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 Code
:MULE_ERROR--2 -------------------------------------------------- ------------------------------异常堆栈为: 1.错误的参数数量(java.lang.IllegalArgumentException)sun.reflect.NativeMethodAccessorImpl:-2(空) 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(本机方法)位于 sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)位于 sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源) + 3个以上(为所有内容设置调试级别日志记录或'-Dmule.verbose.exceptions = true')

ERROR 2014-06-28 20:36:10,289 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Test Before ERROR 2014-06-28 20:36:10,291 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: **************************************************************************** Message : wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: ContentLengthInputStream Code
: MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. wrong number of arguments (java.lang.IllegalArgumentException) sun.reflect.NativeMethodAccessorImpl:-2 (null) 2. wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: ContentLengthInputStream (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

我在google中搜索了一下,发现了这样的内容.我在入站后添加:

I was searching a bit in google and found something like this. I add after inbound:

<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(空) 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(本机方法)位于 sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)位于 sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源) + 3个以上(为所有内容设置调试级别日志记录或'-Dmule.verbose.exceptions = true')

ERROR 2014-06-28 20:45:18,149 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Test Before ERROR 2014-06-28 20:45:18,151 [[gaspoldhlservice].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: **************************************************************************** Message : wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: byte[] Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. wrong number of arguments (java.lang.IllegalArgumentException) sun.reflect.NativeMethodAccessorImpl:-2 (null) 2. wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: byte[] (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:150 -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

我需要在这里稍微推一下它的非常简单的方法,但我无法正确处理...

I need a little bit push here its very simple method and I cant handle it right ...

编辑后:

更改为您的流程,

<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

No such operation: getVersion. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: ContentLengthInputStream

当我使用clientClass而不是serviceClass时:

When I use clientClass instead of serviceClass:

错误的参数数量.无法通过端点路由事件: org.mule.module.cxf.CxfOutboundMessageProcessor.邮件有效载荷为 类型:ContentLengthInputStream

wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: ContentLengthInputStream

推荐答案

编辑后:

使用以下方法更改为您的流程

Changed to your flow with:

<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

No such operation: getVersion. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: ContentLengthInputStream

当我使用clientClass而不是serviceClass时:

When I use clientClass instead of serviceClass:

错误的参数数量.无法通过端点路由事件: org.mule.module.cxf.CxfOutboundMessageProcessor.邮件有效载荷为 类型:ContentLengthInputStream

wrong number of arguments. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: ContentLengthInputStream

这篇关于MULE ESB-简单的Jaxws客户端不起作用...-消息有效载荷的类型为:ContentLengthInputStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆