Document<Service> introspection =
client.get(
args[0]).getDocument();
Service service =
introspection.getRoot();
Collection collection =
service.getCollection(
args[1],
args[2]);
report("The Collection Element", collection.toString());
// Create the entry to post to the collection
Entry entry = factory.newEntry();
entry.setId("tag:example.org,2006:foo", false);
entry.setTitle("This is the title");
entry.setUpdated(new Date());
entry.addAuthor("James");
entry.setContent("This is the content");
report("The Entry to Post", entry.toString());
// Post the entry. Be sure to grab the resolved HREF of the collection
Document<Entry> doc = client.post(
collection.getResolvedHref().toString(),
entry).getDocument();
// In some implementations (such as Google's GData API, the entry URI is
// distinct from it's edit URI. To be safe, we should assume it may be
// different