A webservice should validate input data and write to the database. Later, other services should read the data and create a xml file from it.
So the service just does data transport and transformation (WS-* Parameter => Database).
The “dynamic” webservice should also contain a variable set of parameters (“container”), cause the client changes a lot and quickly which should not end in modification of the interface and the underlying implementation.
How to do and where to handle the validation?
Initial Ideas:
-
Just send a file as attachment and validate it in the webservices with a .xsd schema for the “fixed” and a .xsd schema for the “container” part. If the variable part changes only the “container” .xsd for validation has to change. The container can be base64 encoded xml. If a validation error occurs, the webservice responds with an error.
-
Use all standard items as WSD parameters and pass a base64 encoded container. WS-* takes the validation for the standard parameters and only the container is validated against another .xsd.
No logical/semantic evaluation of the values, that should be done later. Only field-type validation needed.
The container should be xml like:
... standard elements xml ...
<embeddedContainer>
<customItemsFromWSClientOne>
<reallyCustomItemA>
<substructure>
<itemABC></itemABC>
</substructure>
<anotherStructure></anotherStructure>
</reallyCustomItemA>
</customItemsFromWSClientOne>
</embeddedContainer>
... standard elements xml ...
Another Client may send other parameters like ‘customItemsFromWSClientTwo’ with a complete different structure. So the service will become very generic.
There are 2 main types of validations:
Logical validation – run some business logic on the actual values:
if(value==null){//do something}
else{//do something else}
I’m not sure what validation you need, but from what i understand, the “container” should be very dynamic, so it’ll probably contain something like:
In that case an XSD validation won’t do you much good, you probably need to write some logic to figure it out.
I might be completley wrong about the structure, if so please post some example so i can understand it better.
EDIT:
In order to enable the “container” to contain all kinds of XML structure, you’ll need to define it as xsd:any. you can define the
processContentsattribute tostrictand if the right namespace is defined the webservice parser should be able to validate it. look here for more info.Another option might be using groups, look here.