org.mule.api.transformer.TransformerException:无效的返回类型"类[B"是为变压器" JAXBMarshallerTransformer"指定的。

时间:2017-07-04 23:36:14

标签: mule cxf

我在Mule中使用CXF组件来使用webserice。我在Mule 3.8中遇到以下错误

Message               : An invalid return type "class [B" was specified for transformer "JAXBMarshallerTransformer"
Transformer           : JAXBMarshallerTransformer{this=52baa6b2, name='JAXBMarshallerTransformer', ignoreBadInput=false, returnClass=SimpleDataType{type=[B, mimeType='*/*', encoding='null'}, sourceTypes=[SimpleDataType{type=java.lang.Object, mimeType='*/*', encoding='null'}]}

Root Exception stack trace:
  org.mule.api.transformer.TransformerException: An invalid return type "class [B" was specified for transformer "JAXBMarshallerTransformer"

尝试了多个选项,添加了不同的变换器作为响应;没有用!我的流程终于看起来像这样:

<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" basePath="/mule" doc:name="HTTP Listener Configuration"/>
<cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="false" initializeStaticBusInstance="false" doc:name="CXF Configuration"/>
<spring:beans>
    <spring:bean name="StringToDocumentXfm" class="invoke.StringToDocumentTransformer"/>
</spring:beans>
<mulexml:jaxb-context name="JAXB_Context" packageNames="EmployeeSOAClient" doc:name="JAXB Context"/>
<flow name="mule-testproj-soapclientFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/sample" doc:name="HTTP" allowedMethods="GET"/>
    <set-payload value="#[message.inboundProperties.'http.query.params'.empno]" doc:name="Set Payload"/>
    <cxf:jaxws-client operation="getEmployeeDetails" clientClass="EmployeeSOAClient.EmployeeService" port="EmployeePort" wsdlLocation="classpath:Employee.wsdl" doc:name="CXF">
        <cxf:aegis-databinding/>
    </cxf:jaxws-client>
    <outbound-endpoint address="http://localhost:8080/EmployeeSOA/services/Employee" doc:name="Generic" exchange-pattern="request-response"/>
    <response>
        <object-to-string-transformer doc:name="Object to String"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
        <invoke name="Invoke" object-ref="StringToDocumentXfm" method="covertStringToDocument" methodArguments="#[payload]" methodArgumentTypes="java.lang.String"/>
        <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
        <logger message="Output after DOM to XML: #[payload]" level="INFO" doc:name="Logger"/>
    </response>
</flow>

我缺少什么?

谢谢, Aneesh。

1 个答案:

答案 0 :(得分:0)

JAXBMarshallerTransformer不知道如何转换为字节数组(&#34;类[B&#34;)。尝试将Return Class设置为java.lang.String