WSO2 ESB: Unexpected Character Error when submitting JSON to Proxy Service

后端 未结 1 1217
你的背包
你的背包 2021-01-20 10:02

I\'m attempting to retrieve data from Facebook using the WSO2 Facebook Connector in WSO2 ESB 4.9.0. I\'ve provided the proxy configuration below.



        
相关标签:
1条回答
  • 2021-01-20 10:38

    Many thanks @RavindraRanwala and @ThusithaThilinaDayaratne for leading me to the resolution of this issue.

    After consulting the wire logs, it appears the Facebook API is responding with text/javascript content type. I had no message builder/formatter enabled within the ESB to handle this content type, so the process ended up failing. All I needed to do was open up my axis2.xml configuration file and append the following message builders:

    <!--JSON Message Builders-->
    <messageBuilder contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
    <messageBuilder contentType="text/javascript" class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
    

    ... and formatters:

    <!--JSON Message Formatters-->
    <messageFormatter contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
    <messageFormatter contentType="text/javascript" class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
    

    The most up to date documentation on the Facebook connector seems to be at the GitHub page, where all the necessary builder/formatter information is clarified:

    https://github.com/wso2/esb-connectors/tree/master/facebook/facebook-connector/facebook-connector-1.0.0

    0 讨论(0)
提交回复
热议问题