SOA Tips-Use strongly typed messages - Avoid use of xsd string to represent the entire message Body26 Apr 2007
You have to clearly define a strongly typed XML schema for the messages that you exchange between a provider and a consumer and ensure that each of your message exchanges are strongly typed. This also ensures that you establish well-defined and well-understood semantics for communication between your external partners even though each of your internal implementations may evolve independent of each other. Just because having a strongly typed schema for the message is not enforced anywhere, you have to stay away from the tendency to use an xsd:string element to represent your entire message body.
If you go ahead and do represent your message body as an xsd:string type, you could probably develop some simple clients. There may be no issues with interoperability between the frameworks you use - be it Java or .NET - since your whole XML payload within the message body carries the message data as a string.
However the big downsides to this approach are as follows:
- Your Service Interface is not descriptive anymore since the document type is just an xsd:string.
- Any schema validation provided by the runtime cannot be used to validate the message body since the payload is no longer strongly typed.
- It can also be memory intensive since the whole XML document may have to be read into memory as a string for each request.