Mule method cannot be cast to string

六眼飞鱼酱① 提交于 2019-12-20 06:27:23

问题


i'm very new to mule studio.

This is the environements setup.

VM1 = Windows 7, Visual Studio 2012, IIS 7. A .net 4.5 WCF webservice hosted in IIS7 that has an operation that accepts a string and returns a string.

VM2 = Ubuntu 13.4 OpenJDK 1.7.0_25 Mule Studio 3.5 Community Edition.

I created a JAXWS-Client with an outbound endpoint, I did this by clicking the generate from WSDL and entering the url of the .net WCF webservice hosted in IIS on VM1. That was fine.

I then created an inbound endpoint with a jaxws-Service in-between the inbound service and the outbound client there is a logger and an object to string.

If I setup a vanilla inbound endpoint (no soap) and use a simple html form to post it all works fine and I get a string back to the browser. But adding the Soap Component causes the dispatcherexception when the flow hits the Soap Component just prior to the outbound endpoint.

org.mule.api.transport.DispatchException: 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

 <flow name="testtwoFlow1" doc:name="testtwoFlow1">
    <http:inbound-endpoint exchange-pattern="request-response"   path="SimplePing" doc:name="HTTP" host="0.0.0.0" port="8081"/>

    <cxf:jaxws-service serviceClass="TestTwo.IPing" doc:name="SOAP" />

    <logger level="INFO" doc:name="Logger"/>
    <object-to-string-transformer doc:name="Object to String"/>
    <flow-ref name="testtwoFlow3" doc:name="Flow Reference"/>

</flow>
<sub-flow name="testtwoFlow3" doc:name="testtwoFlow3">

    <cxf:jaxws-client operation="SimplePing" serviceClass="TestTwo.IPing" enableMuleSoapHeaders="true" doc:name="SOAP"/>

    <logger level="INFO" doc:name="Logger"/>
    <http:outbound-endpoint exchange-pattern="request-response" host="192.168.0.2" port="80" path="MuleExperiments/Ping.svc" method="POST" doc:name="HTTP" />
</sub-flow>

I Have googled extensively and I haven been much in the way if examples that show an inbound service interacting with an outbound client. Or descriptions of the exception thrown, what causes it and how to address it. I'm guessing pretty much its because the service and the client are generated from the same WSDL, but I wouldn't have thought that would be a real issue. Or that in my cxf:jaxws-service & cxf:jaxws-service the service class is the same.

What my goal is, at this juncture, is to have a simple in/out of a string


回答1:


My client was wrongly configured. It should have been clientClass, not serviceClass, and the port needed to be set as well. Once I made these changes, I got it working.

<cxf:jaxws-client
   operation="SimplePing"
   enableMuleSoapHeaders="true"
   doc:name="SOAP"
   clientClass="TestTwo.PingService"
   port="BasicHttpBinding_IPing"
/>


来源:https://stackoverflow.com/questions/18297125/mule-method-cannot-be-cast-to-string

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!