Java Reference
In-Depth Information
9. Type 1 in the id field and click Test to test the GET method.
The following status message appears:
Status: 200 (OK)
The XML output for the resource appears in the Response window:
Click here to view code image
<?xml version="1.0" encoding="UTF-8"?>
<customer xmlns="http://xml.customer" id="1">
<firstname>Duke</firstname>
<lastname>OfJava</lastname>
<address>
<number>1</number>
<street>Duke's Way</street>
<city>JavaTown</city>
<state>JA</state>
<zip>12345</zip>
<country>USA</country>
</address>
<email>duke@example.com</email>
<phone>123-456-7890</phone>
</customer>
A GET for a nonexistent ID also returns a 200 (OK) status, but the output in the Re-
sponse window shows no content:
Click here to view code image
<?xml version="1.0" encoding="UTF-8"?>
<customer xmlns="http://xml.customer"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:nil="true"/>
You can test other methods as follows:
• Select PUT, type the input for an existing customer, modify any content except the
id value, and click Test to update the customer fields. A successful update returns
the following status message:
Status: 303 (See Other)
• Select DELETE, type the ID for an existing customer, and click Test to remove the
customer. A successful delete returns the following status message:
Status: 204 (See Other)
Search WWH ::




Custom Search