API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Getting "Error attempting to read the urlopen response data" error while hitting endpoint URL from API connect

  • 1.  Getting "Error attempting to read the urlopen response data" error while hitting endpoint URL from API connect

    Posted Mon October 31, 2022 04:59 AM
    Hello Team,

    We are getting "Error attempting to read the urlopen response data" while hitting backend (endpoint URL) from API connect.
    When we hit it through system (postman application), we are getting successful response.But response payload content-type shows "application/XML" (in headers) and  response payload format is JSON.

    Can this issue be resolved  at backend or can we resolve it in API connect.Please suggest on it.

    Thank you.

    ------------------------------
    Jyoti Yadav
    ------------------------------


  • 2.  RE: Getting "Error attempting to read the urlopen response data" error while hitting endpoint URL from API connect

    Posted Mon October 31, 2022 06:12 AM
    Hi Jyoti,

    When testing direct backend through postman getting same header content-type "application/XML" then change the API Consumes and Produce value to your expected values, if backend also able to modify modify the content-type header to "application/json".

    if not getting through postman, use the parse function in gateway script to handle the response it can be any format.

    ------------------------------
    kandula nagababu
    ------------------------------



  • 3.  RE: Getting "Error attempting to read the urlopen response data" error while hitting endpoint URL from API connect

    Posted Mon October 31, 2022 09:16 AM
    Hello kandula,

    Content-Type of request payload is "text/plain", but Backend application responses us with conetnt-type application/xml. 
    How to accept different content-type response in API connect?


    ------------------------------
    Jyoti Yadav
    ------------------------------



  • 4.  RE: Getting "Error attempting to read the urlopen response data" error while hitting endpoint URL from API connect

    Posted Tue November 01, 2022 08:49 AM

    Hi Jyoti,

    In APIC v5 or v10's v5 compatible gateways, the invoke policy will implicitly attempt to parse the response payload based on the response's content-type header and will fail the transaction if a parse error occurs.  This is a backend issue where the response's content type header is not properly describing the payload it is returning.  In APIC v10 native API Gateway, there is no implicit parsing of the response in the invoke policy.  That is done explicitly in the assembly using a parse action, which if configured as "detect" it would parse based upon the payload, not on the response header, but if configured to use content type, it would fail in a similar fashion.   There is no workaround for this in v5/v5c other that to have the backend properly return a proper content type.

    Best Regards,
    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------