- I have started with an XML Schema
- Communication is by plain POST requests
- I submit objects encoded as instances of the schema to the server, and get another encoded object back as part of the response
- The objects are actually Java objects, but this is irrelevant, I have generated the classes from the schema using Jaxb.
- I am using the Apache commons client to do the plumbing .
Object obj = ... ; // the object to be posted
HttpClient client = new HttpClient();
StringWriter stringWriter = new StringWriter();
// serialize object, uses the generated API !!
WopperRPCUtil.write(stringWriter,object);
// make request
PostMethod post = new PostMethod(url);
post.setRequestEntity(new StringRequestEntity(stringWriter.toString()));
int statusCode =statusCode = client.executeMethod(post);
No comments:
Post a Comment