mule- serialization exception while making outbound call

半世苍凉 提交于 2019-12-11 02:48:26

问题


I have a simple flow which has an http inbound endpoint. I am trying to consume a http outbound and received the following exception.

I am able to consume the same outbound directly from SOAP UI. But, unable to call through Mule flow.

java.io.OptionalDataException (org.apache.commons.lang.SerializationException)

Response from the Endpoint ...Internal Server Error, code: 500

    INFO  2014-02-17 07:16:41,234 [[updatecustomer].connector.http.mule.default.receiver.02]
     org.mule.api.processor.LoggerMessageProcessor: Logger ...in main thread
     java.io.OptionalDataException (org.apache.commons.lang.SerializationException)

Hope this raw xml would be of help to identify issue.

Raw XML from SOAP UI Input:

    POST http://localhost:8080/foo3 HTTP/1.1
    Accept-Encoding: gzip,deflate
    Content-Type: text/xml;charset=UTF-8
    SOAPAction: ""
    Content-Length: 2044
    Host: localhost:8080
    Connection: Keep-Alive
    User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Raw XML from SOAP UI Output(while hitting the endpoint directly):

    HTTP/1.1 200 OK
    Date: Tue, 18 Feb 2014 06:10:56 -0600
    Server: Mule Core/3.4.0
    Content-Type: text/xml; charset=UTF-8
    X-MULE_SESSION: sjkfsdhbbzzzxxxxxxx ....
    http.method: POST
    X-MULE_ENCODING: UTF-8
    Transfer-Encoding: chunked
    Connection: close

Raw XML from SOAP UI while hitting through Mule flow:

    HTTP/1.1 500 Internal Server Error
    Content-Type: text/plain
    Date: Tue, 18 Feb 2014 06:09:49 -0600
    Server: Mule EE Core Extensions/3.4.1
    http.status: 500
    X-MULE_SESSION: sdkfasdfgsdkgfbsdfkxxxxxxxhshduiaodudyy.....
    X-MULE_ENCODING: UTF-8
    Content-Length: 78
    Connection: close

回答1:


Try setting a NullSessionHandler for the HTTP connector:

<http:connector name="NoSessionConnector">
    <service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:connector>



回答2:


This sounds like you are sending some incorrect headers or data to the outbound and it responds with 500 error. A typical problem is to use incorrect Content-Type header, so you might be missing something like <set-property propertyName="Content-Type" value="text/xml;charset=UTF-8"/> before the endpoint. Also add the soap header SOAPAction from SoapUI similarly and ensure your outbound HTTP endpoint is POST.

For debugging, I suggest you try Postman or some other simple HTTP client to get a successful response and then set the exact same headers/data in Mule. Use a logger before the outbound endpoint to ensure your message body matches the one you could use successfully in SoapUI/Postman. Also, log the HTTP response before you try to map that to anything, so you know you are not doing that with invalid data. If you have developer access to the service you are calling, see what the logs say there.



来源:https://stackoverflow.com/questions/21850187/mule-serialization-exception-while-making-outbound-call

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