Ask the Expert

Publishing an XML message definition within a WSDL for Web services

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?

    Requires Free Membership to View

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.

This was first published in June 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: