Hi Manish,
You mention in the title application/xhtml+xml
but your backend response returns html code as response with content-type as text/html
. Are you attempting to parse the backend response? If so, what does that parse policy look like and what version of DataPower are you using? If you are doing a parse policy and the use content type
option is selected, there was an issue at one time, since fixed, where text/html
was attempting to parse the payload as xml and would fail. Also, if the parse object settings reference is Default, that default parse settings uses a type of Detect and unfortunately will see the starting <
to tell it to attempt to parse as xml and would also fail. Even if the html was well formed from an XML perspective, with the DOCTYPE you probably have an external reference which is forbidden and will also cause the parse to fail. Are you attempting to extract something from this backend response where you need the payload parsed? If not the solution would be as simple as removing the parse policy. If you only get this error on the text/html error responses, but otherwise are getting valid JSON responses to your JSON request, assuming you have a later version with the fix you could do a parse with content-type and the html would be parsed as a binary stream and not as an xml document.
Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Mon March 25, 2024 07:33 PM
From: Manish Raj
Subject: application/xhtml+xml parsing issue
Hi All,
I have an API which takes application/json as input and returns html code as response with content-type as text/html. For some reason api is unable to return the response even though it's able to invoke the backend call and fetch the response. Below is the sample response
<!DOCTYPE html\n PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<!--suppress" href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\%22>\n<!--suppress" rel="noreferrer noopener" target="_blank" class="fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn" title="http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd/%22%3e/n%3c!--suppress">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<!--suppress CheckTagEmptyBody -->
------------------------------
Manish Raj
------------------------------