Mule和java.lang.reflect.Method不能转换为flow-ref中的java.lang.String

时间:2014-01-13 01:56:29

标签: mule mule-studio

我有一个子流来调用soap服务(req:String,response:String)

<sub-flow name="vinculaValidaServiceClienteFlow" doc:name="vinculaValidaServiceClienteFlow">
    <cxf:jaxws-client operation="vinculaServicioIngreso" serviceClass="...VinculaValidaService"  doc:name="SOAP"/>
    <http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8070/pic/vinculaValidaService" doc:name="HTTP"/>
</sub-flow>

我有一个简单的服务,我从测试流程调用。使用MuleClient可以很好地调用此服务:

<flow name="vinculacionFlow2" doc:name="vinculacionFlow2">
    <vm:inbound-endpoint exchange-pattern="request-response" path="test2" doc:name="VM"/>
    <logger level="INFO" doc:name="Logger"/>
    <flow-ref name="vinculaValidaServiceClienteFlow" doc:name="Flow Reference"/>
</flow>

当我在主流中包含flow-ref时,虽然单元测试成功,但无法调用。

<flow name="vinculaServiceFlow" doc:name="vinculaServiceFlow">
    <http:inbound-endpoint exchange-pattern="request-response"   doc:name="vinculaServiceHTTP" ref="vinculaServiceHTTPEndpoint"/>
    <logger level="INFO" doc:name="Logger" message="luna es #[payload]"/>
    <cxf:jaxws-service doc:name="vinculaServiceSOAP" serviceClass="...service.VinculaService"/>
    <byte-array-to-string-transformer doc:name="Byte Array to String"/>
    <logger message="marte es #[payload]" level="INFO" doc:name="printpayload"/>
    <set-variable variableName="cedula" value="#[message.payload]" doc:name="Variable"/>
    <logger message="jupiter es #[flowVars['cedula']]" level="INFO" doc:name="printVar"/>
    <set-payload value="#[message.payloadAs(java.lang.String)]" doc:name="Set Payload"/>
    <logger message="sol es #[payload]" level="INFO" doc:name="printpayload"/>
    <flow-ref name="vinculaValidaServiceClienteFlow" doc:name="Flow Reference"/>
    <scripting:transformer doc:name="Groovy">
        <scripting:script engine="Groovy"><![CDATA[import   ec.gob.presidencia.tecnologia.pic.vincula.service.VinculaResponse def responseVincula = new VinculaResponse("54545366644","12063139", "se puede vincular") return responseVincula ]]>   
        </scripting:script>
    </scripting:transformer>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <set-payload value="Error durante el procesamiento del servicio de vinculacion" doc:name="Set mensejae error"/>
    </catch-exception-strategy>
 </flow>

产生的异常是:

异常堆栈是:

1. java.lang.reflect.Method cannot be cast to java.lang.String(java.lang.ClassCastException)
  org.mule.module.cxf.CxfOutboundMessageProcessor:338 (null)
2. java.lang.reflect.Method cannot be cast to java.lang.String. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: String (org.mule.api.transport.DispatchException)
  org.mule.module.cxf.CxfOutboundMessageProcessor:150 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to service.VinculaResponse
    at ec.gob.presidencia.tecnologia.pic.vincula.service.jaxws_asm.VinculaServicioIngresoResponse_WrapperTypeHelper1.createWrapperObject(Unknown Source)
    at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:100)
    ... 97 more

这个异常无法理解,因为在调用服务之前将有效负载转换为字符串(flow-ref)。可以给我一个想法来确定这一点在哪里纠正吗?

感谢。

1 个答案:

答案 0 :(得分:0)

可能与此重复吗? Mule method cannot be cast to string

如果您的目的是将入站SOAP调用映射到出站SOAP调用,您可能还需要考虑使用代理:http://www.mulesoft.org/documentation/display/current/Proxying+Web+Services+with+CXF