To receive XML from the server, you need to send a GET request and specify the Accept: application/xml header in the request. The Accept header tells the server that your client is expecting XML data. Without this header, the server may return data in a different format. The Content-Type: application/xml response header informs the client that the server returned XML. In this GET XML Example, we are sending a GET request to the ReqBin echo URL. Click Send to execute the GET XML request online and see the results. The Java code was automatically generated for the GET XML example.
HTTP GET is the most popular of the nine commonly used HTTP methods. The GET request method is used to retrieve data from the specified URL, cannot contain data in the body of the GET request, and should not change the server state. The GET method is defined as idempotent, which means that several similar GET requests should have the same effect on the server as a single request.
HTTP GET Request Example
GET /echo/ HTTP/1.1
What is XML?
XML (eXtensible Markup Language) is an extensible markup language that provides structured information: data, documents, configuration, and more. XML is called extensible because it does not capture the markup used in documents: you can create markup according to the needs of a specific area, limited only by the rules of XML syntax. An XML file is a simple text format that uses custom XML tags to describe the structure of a document and how it should be stored and transported.