0
votes

I have a sub-flow to invoke a soap service (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>

I have a simple service that I'm calling from a test flow. This service can be invoked well with 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>

When I include the flow-ref in a main flow, can not be invoked, although the unit test was successful.

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

The resulting exception is:

Exception stack is:

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

This exception can not understand it, since the payload into a string before invoking the service (flow-ref). Could give me an idea to identify where this point at correcting?

Thanks.

1

1 Answers

0
votes

Could be a duplicate of this? Mule method cannot be cast to string

You might also want to consider using proxying if your purpose is to map inbound SOAP calls to outbound SOAP calls: http://www.mulesoft.org/documentation/display/current/Proxying+Web+Services+with+CXF