There exists a Relaxation Web Service that utilizes Publish - to place data into database (unmarshall data from XML), and obtain to retrieve data (marshalled into XML).

An XSD can be used to create Java objects (via Sun's JAXB compiler) to marshall/unmarshall data back and forth from a database. We type of froze the XSD because it is, because we thought this models the information perfectly - also it does, only for posting data really.

Now when comes time to GET data in the database, I've found myself needing to "break" our current XSD and let it publish primary secrets along with other data values that Publish-type demands don't worry about, they're unnecessary.

So - essentially the XSD presently has optional elements inside it (i.e individuals used just for GET demands). This might cause potential confusion if you need to show 3rd parties who wish to make use of your web service and you've got this XSD which has a type of split personality between getting and posting data. Additionally, it does not feel neat and elegant as previously.

What must i do? Could it be OK to possess elements inside your XSD which are only utilized in a particular conditions (like getting data)? Or must i have 2 XSDs Body more verbose, customized to obtain demands and something slimmed lower, purely for Publish request??

Your information - much appreciated.

I had been inside a similar situation and produced a view which i employed for my "reading through" reasons. Then i planned the vista in to the same XSD as my primary tables and so i could keep it in check on this page. It provided the versatility from the "looser" reading through without be worried about corrupting initially my data arrangement.

Getting fields which are only utilized in some contexts is alright in XML documents as lengthy while you document it adequately. UDDI (yes I understand, a completely not-Relaxation and uncool example) does exactly that. Whenever you "save" or "update" an entry in UDDI, similar for your Publish and set, you have to give you the unique ID within the released data so that the server knows what related to it. The benefit here is you have one schema element and something resulting data structure to cope with for many procedures on that data structure (for CRU although not always for D in UDDI). As you are Peaceful and may represent the initial identifier within the resource's URL, this method could make less sense for the application. One factor to think about is that if the retrieved data will be passed around after retrieval. When the data must be all-in-one and it is passed around within or between different contexts inside your clients, then such as the ID is probably useful towards the customers of the service because they will not suffer from two bits of data (the particular data, and it is unique identifier). Nevertheless, your customers may abstract away the Relaxation/XML interaction entirely by which situation, their abstraction most likely already handles the ID and also the remaining fields from the data structure.