Table 3: HTTP Request and HTTP Response Messages for the Purchase Order Service
 
 
Operation
HTTP Request
HTTP Response
Java Technology Method
Create
POST /restfulwebservice-war/poservice/ HTTP/1.0
Accept: */*
Connection: close
Content-Type: text/xml
Content-Length: 618
Pragma: no-cache

<tns:PurchaseOrderDocument xmlns:tns="urn:PurchaseOrderDocument">
<billTo>
<street>1 Main Street</street>
<city>Beverly Hills</city>
<state>CA</state>
<zipCode>90210</zipCode>
</billTo>
<createDate>2004-03-27T12:21:02.055-05:00</createDate>
<poID>ABC-CO-19282</poID>
<items>
<itemname>Copier Paper</itemname>
<price>10</price>
<quantity>2</quantity>
</items>
<items>
<itemname>Toner</itemname>
<price>920</price>
<quantity>1</quantity>
</items>
<shipTo>
<street>1 Main Street</street>
<city>Beverly Hills</city>
<state>CA</state>
<zipCode>90210</zipCode>
</shipTo>
</tns:PurchaseOrderDocument>
HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Content-Type: text/xml
Date: Fri, 21 Jul 2006 17:07:15 GMT
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<ns2:Status xmlns:ns2="urn:Status" xmlns:ns3="urn:PurchaseOrderDocument"
xmlns:ns4="urn:POProcessingFault"><orderid>ABC1153501634787</orderid>
<timestamp>Fri Jul 21 13:07:14 EDT 2006</timestamp></ns2:Status>
public PurchaseOrderStatus acceptPO(PurchaseOrder order)
Read
GET /restfulwebservice-war/poservice/ABC1153501634787 HTTP/1.0
Connection: close
Content-Type: text/xml
HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Content-Type: text/xml
Connection: close

<?xml version="1.0" encoding="UTF-8"?><ns3:PurchaseOrderDocument
xmlns:ns3="urn:PurchaseOrderDocument" xmlns:ns2="urn:Status"
xmlns:ns4="urn:POProcessingFault"><billTo><street>1 Main Street</street>
<city>Beverly Hills</city><state>CA</state><zipCode>90210</zipCode></billTo>
<createDate>2006-07-21T13:08:37.505-04:00</createDate>
<items><itemname>Copier Paper</itemname><price>10</price><quantity>2</quantity></items>
<items><itemname>Toner</itemname><price>920</price><quantity>1</quantity></items>
<poID>/ABC1153501634787</poID><shipTo><street>1 Main Street</street><city>Beverly Hills</city><state>CA</state><zipCode>90210</zipCode></shipTo></ns3:PurchaseOrderDocument>
public PurchaseOrder retreivePO (String orderID)
 
GET /restfulwebservice-war/poservice/ HTTP/1.1
Connection: keep-alive
HTTP/1.1 400 Bad Request
X-Powered-By: Servlet/2.5
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?><ns4:POProcessingFault
xmlns:ns4="urn:POProcessingFault"
xmlns:ns2="urn:Status" xmlns:ns3="urn:PurchaseOrderDocument">
<message>Unable to retrieve the order associated with the orderid you specified</message>
</ns4:POProcessingFault>
Indicates a problem finding the order
Update
PUT /restfulwebservice-war/poservice/ HTTP/1.0
Connection: close
Content-Type: text/xml
Content-Length: 620
Pragma: no-cache

<tns:PurchaseOrderDocument xmlns:tns="urn:PurchaseOrderDocument">
<billTo>
<street>1 Main Street</street>
<city>Beverly Hills</city>
<state>CA</state>
<zipCode>90210</zipCode>
</billTo>
<createDate>2004-03-27T12:21:02.055-05:00</createDate>
<poID>ABC-CO-19282</poID>
<items>
<itemname>Copier Paper</itemname>
<price>10</price>
<quantity>2</quantity>
</items>
<items>
<itemname>Toner</itemname>
<price>920</price>
<quantity>1</quantity>
</items>
<shipTo>
<street>1 Main Street</street>
<city>Beverly Hills</city>
<state>CA</state>
<zipCode>90210</zipCode>
</shipTo>
</tns:PurchaseOrderDocument>
HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?><ns3:PurchaseOrderDocument xmlns:ns3="urn:PurchaseOrderDocument"
xmlns:ns2="urn:Status" xmlns:ns4="urn:POProcessingFault">
<billTo><street>1 Main Street</street><city>Beverly Hills</city><state>CA</state><zipCode>90210</zipCode></billTo>
<createDate>2004-03-27T12:21:02.055-05:00</createDate>
<items><itemname>Copier Paper</itemname><price>10</price><quantity>2</quantity></items>
<items><itemname>Toner</itemname><price>920</price><quantity>1</quantity></items>
<poID>ABC-CO-19282</poID><shipTo><street>1 Main Street</street><city>Beverly Hills</city><state>CA</state><zipCode>90210</zipCode></shipTo></ns3:PurchaseOrderDocument>
public PurchaseOrder updatePO(PurchaseOrder order)
Delete
DELETE /restfulwebservice-war/poservice/ABC-CO-19282 HTTP/1.0
Connection: close
Content-Type: text/xml
Content-Length: 0
Pragma: no-cache
HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Content-Type: text/xml
Date: Fri, 21 Jul 2006 17:10:38 GMT
Server: Sun Java System Application Server Platform Edition 9.1
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
public void cancelPO(String orderID)