This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services and the fly likes WSDL: How to put common messages in one file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Web Services
Bookmark "WSDL: How to put common messages in one file?" Watch "WSDL: How to put common messages in one file?" New topic

WSDL: How to put common messages in one file?

Loganathan Karunakaran
Ranch Hand

Joined: Nov 04, 2008
Posts: 78

I am creating few WSDLs and I want to share the error messages across these WSDL. Currently I am repeating the error messages in all the WSDL files. Is there a way to put all the common messages and re-use it in different WSDL. Please assist.


Surender Suri
Ranch Hand

Joined: May 28, 2010
Posts: 42
Move all the common elements to .xsd file (for example common.xsd) and import that common.xsd file into each individual wsdl files.

Example: In wsdl as below
<schema xmlns="" elementFormDefault="qualified" targetNamespace="your name space">
<include schemaLocation="common.xsd"/> // put common.xsd in the same folder as wsdl.

You can also extend the common element (in this case your error message element) to add more info, like

<element name="CustomErrorMessage">
<extension base="tns:ErrorMessage"> // this is your common error message element
<element name="AdditionalInfo" type="tns:AdditionalInfo" minOccurs="0" nillable="true"/>
.. you can add more elements here ..

I agree. Here's the link:
subject: WSDL: How to put common messages in one file?