This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread 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 Java 8 in Action this week 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
Author

WSDL: How to put common messages in one file?

Loganathan Karunakaran
Ranch Hand

Joined: Nov 04, 2008
Posts: 76
Hi,

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.

Thanks
Loganathan


OCPJP 1.6
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
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="your name space">
<include schemaLocation="common.xsd"/> // put common.xsd in the same folder as wsdl.
</schema>
</types>

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

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


Thanks,
Suri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSDL: How to put common messages in one file?
 
Similar Threads
Wsdl2java Issues
Suppress warn log for a single class
adding image with h:messages tag
Axis WSDL2Java's Error: reference but not defined
reading soap-envelop messages