2
votes

I am trying to proxy the following call through WSO2 API Manager

http://api.qrserver.com/v1/create-qr-code/?data=HelloWorld&size=100x100

which returns a QR code image. I published the API using http://api.qrserver.com/v1/ as endpoint, no problem there. But when I perform the call through the API Manager, I get the following error:

curl -H 'Authorization:Bearer 7q6W4LteX9idveFWbSa_oaGPhVsa' 'http://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8280/qrcode/1.0.0/create-qr-code/?data=HelloWorld&size=100x100'

<Exception>Unexpected response received. HTTP response code : 200 HTTP status : OK exception : com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x89 (at char #1, byte #-1)</Exception>

when performing the call directly the response header seems good to me (the mime type image/png is correctly set), but the WSO2 API proxy refuses the response... what I am doing wrong? Setting a wadl file with response mediaType="image/png" does not seem to help either.

Thanks in advance

2
Can you check the particular media type is added in the axis2 .xml. Where we define message formatters and builders for the content types. you might need to add the image/png also there - Ratha
great! after adding both formatter and builder for image/png the call seems to succeed. Could you please point me to the documentation explaining these more advanced topics? many thanks! - user2068318
Here is an article explains teh stuff wso2.org/library/articles/… - Ratha

2 Answers

0
votes

I have a similar problem in wso2 esb. Seems that the response works with short xml files but not with a big one.

0
votes

This problem is due to not having match message builders and formatters by default in API manager's axis2.xml. Please add following parameters to axis2.xml.

<messageBuilder contentType=".*" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageFormatter contentType=".*" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

Thanks. Sanjeewa.