0

I am trying to validate a webservice response whose content type is "application/octet-stream":

Output:

java.lang.IllegalStateException: Expected response body to be verified as JSON, HTML or XML but content-type 'application/octet-stream' is not supported out of the box. Try registering a custom parser using:

RestAssured.registerParser("application/octet-stream", <parser type>);

Below is the screenshot for the XML format and the Java code.

enter image description here

enter image description here

James Z
  • 12,209
  • 10
  • 24
  • 44
titli0216
  • 37
  • 1
  • 1
  • 9
  • Could you provide stack trace? Which line of your code throws this exception? – lucas-nguyen-17 Aug 10 '23 at 02:09
  • 1
    The workaround is: //First converting the webservice to a string String xml_string=response.asString(); XmlPath xp = new XmlPath(xml_string); String partName=xp.get("xml_path"); – titli0216 Aug 10 '23 at 11:10
  • Another way which I got to know after speaking with the development team is that if we know the nature of the webservice response then we can set the content type as "application/xml" (in my case) and deploy the code. This will save the testing code effort. – titli0216 Aug 18 '23 at 13:14

0 Answers0