I am using google chrome plugin Postman for testing some restful web services. Some of my webservices have a produces annotation that has several types defined. Each time I run one of my services though, it seems postman's results are determined to always return in octect-stream form. Is there a way to force postman (or potentially my service) to return application/xml results? I would prefer not to change the annotation but will if thats my only choice.
My service definition -
@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,
"application/x-javascript", MediaType.APPLICATION_OCTET_STREAM } )
@Path( "/getCustomers/" )
public Response getCustomers
My postman call is just a GET call with no parameters on the header like this:
http://myserver:8080/test/getCustomers
Set the request method to POST . Under the Body tab, set the body type to raw and select XML from the dropdown. Once you add XML data as the body, Postman will automatically add a Content-Type header that can be seen under the Headers tab. While REST typically uses JSON and other data formats, SOAP relies on XML.
Data types that REST API can return are as follows: JSON (JavaScript Object Notation) XML. HTML.
Maybe your default response type is octect-stream
Use the below http headers in POSTMAN
Accept: application/xml
Do the server validations based on Accept headers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With