Gopalan Suresh Raj's Web Cornucopia
An Oasis for the parched Enterprise Services Engineer/Developer

    SOA Tips-Use strongly typed messages - Avoid use of xsd string to represent the entire message Body

    SOA-Tips

    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.

    Author Bibliography

    Gopalan Suresh Raj is a Senior Analyst, Software Architect, and Developer with expertise in multi-tiered systems development, enterprise service architectures, and distributed computing. He is also an active author, including contributions to Professional JMS Programming, Wrox Press, 2001, Enterprise Java Computing-Applications and Architecture, Cambridge University Press, 1999, and The Awesome Power of JavaBeans, Manning Publications Co., 1998. He has submitted papers at international fora, and his work has been published in numerous technical journals. Visit him at his Web Cornucopia© site (webcornucopia.com) or mail him at gopalan@webcornucopia.com.

    Back