What is the best way to publish a document/literal XML message definition within a Web Services Description Language (WSDL) file?
Should I define a schema that takes a single xsd:string and have clients pass in an XML document wrapped within a CDATA section for more control over versioning, error handling, etc.? Or should I publish strongly typed User Defined Types in the WSDL that exactly map to the XML message?
In the latter case, the message can be validated by the SOAP engine and client code tools, such as WSDL.EXE or WSDL2JAVA, and can create easy to use clients. Which approach makes the most sense and will keep us compliant with WS-* specifications?
Definitely do not send the message as a string wrapped within a CDATA section. That approach defeats many of the valuable features of using SOAP and WSDL. You should strongly type the messages, and specify the type information using XML Schema, for all the reasons you say and more. For example, without a proper schema, you can't specify which parts of the message you would like to sign or encrypt using WS-Security.
Dig Deeper on Securing services
Related Q&A from Anne Thomas Manes
Anne Thomas Manes explains the differences between open source clients and open source implementations. Continue Reading
Anne Thomas Manes discusses the best way to go about creating an enterprise data dictionary and why the systems works well. Continue Reading
Anne Thomas Manes explains the difference between 'hard' real time and 'live' real time systems. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.