Forum Discussion

phani's avatar
phani
Advisor
10 years ago

http.client FreeMarker Context Object is returning the error "html found in response"

Hi,

 

We are trying to get HTML/XML data from thirdparty API by using http.client FreeMarker Context Object.

E.X.:  <#assign response = http.client.request(API).header("Authorization", token).body("{ 'mode':'test'}", "application/xml").get()/>

 

The http.client.response FreeMarker Context Object (${response.error.message})  is returning the errror  "html found in response".

 

We even tried changing the Content-Type to "text/html" but same error we are reciving.

 

Your help could be highly appreciated.

Thanks & Regards,

Phani

  • Hi Phani

     

    I've updated a config on that community.  Please try again and let me know if it now works.

     

    Thanks

    Noaman

8 Replies

  • NoamanA's avatar
    NoamanA
    Lithium Alumni (Retired)
    10 years ago

    Hey Phani

     

    Which community instance are you trying this on?

     

    There could be a backend configuration affecting this.

     

    Regards

    Noaman

  • NoamanA's avatar
    NoamanA
    Lithium Alumni (Retired)
    10 years ago

    Hi Phani

     

    I've updated a config on that community.  Please try again and let me know if it now works.

     

    Thanks

    Noaman

  • phani's avatar
    phani
    Advisor
    10 years ago

    Hi NoamanA,

     

    The response is coming as expected.

     

    Thank you for your support.

     

    Regards,

    Phani

  • phani's avatar
    phani
    Advisor
    10 years ago

    Hi NoamanA,

     

     XML tags are trimming from the response.

    For E.X.: 

    API output = <message>Hello World <div>Welcome</div></message>

     

    The data coming from http.client.response FreeMarker Context Object(${response.content}) as follows

    Hello World <div>Welcome</div>

     

    We are able to get exact output (<message>Hello World <div>Welcome</div></message>) when we are trying in Javascript.

     

    Please provide your inputs.

     

    Thanks,

    Phani

     

     

  • phani's avatar
    phani
    Advisor
    10 years ago

    Hi NoamanA,

     

    Could you please let us know what is the configuration change you have performed to access html/xml data?

     

    Thanks,

    Phani

  • phani's avatar
    phani
    Advisor
    10 years ago

    Hi luk,

     

    There is a config httpclient.allowed_html_elements that can be configured in the community to allow any specific html elements. For

     

    example: httpclient.allowed_html_elements = a,p,div

     

    Contact support team, they might help you on this.

     

    Thanks,

    Phani