RESTful Web Services: Documenting XML for the same resource

Black Mask

New Member
I'm using the W3C XML Schema (XSD) for documenting resources. Today, XML representation is returned in a handful of resources. A POST operation on one of my resources requires XML from the client. The response for this resource is XML. My question is as follows:a) Should I create one XSD to handle request (POST), response for the resource?b) If a single XSD is being used, how should I differentiate between request (POST) and responses? One thought surrounds:\[code\]<stream> <request> <items>xxx</items> </request> <response> <stuff>xxx</stuff> </response></stream>\[/code\]Trouble is, I fear the request/response tags reflect an RPC style approach.c) With regards to POST operations, I'd like to inform client that XML is required and is only allowed during POST operations. I suspect if this requirement is violated my best option is to return a 400 bad request? Beyond that, I think my only option with respect to my XSD is 'documenting via comments the requirement'? Just trying to get a feel for any XSD design options I should consider besides comments. Of course the challenge with one XSD is a response to a GET operation - which does not require a XML from the client - will require the client to 'ignore' the POST content in the XML. Thanks in advance
 
Back
Top