Skip to main content

Is there any Java API/Library for creating (WSDL) and Xml Schemas ?

1 reply [Last post]
tomjo
Offline
Joined: 2008-05-17
Points: 0

I did not find any forum specifically dedicated to Xml Schema, so I am trying this forum instead and hope it is okay (since schemas is a part of WSDL).

How should you programatically create Xml Schemas, and WSDL files that includes XML schemas ?
Is there any java library that can be used for creating Xml schemas ?

I also am interested in creating WSDL programmatically, and for this I thought I had found what I was looking for when I found WSDL4J:
http://sourceforge.net/projects/wsdl4j/

However, this API does not seem to be able to create Schema files.
The interface "javax.wsdl.Definition" in that API include the following methods:
addMessage
addPortType
addBinding

Also, in the interface "javax.wsdl.Definition" there is a method
"Types createTypes()"
However, I can not figure out how to use the returned "Types" interface to add the Xml Schema type definitions of the desired elements into the wsdl definition.
(I have been browsing around in the javadoc and been searching in the superinterfaces of "Types" for methods such as "addComplexType" and "addSequence" which I expected to exist...)

If you do not understand what I am looking for, here is an example of what I would like to do with some API for creating Xml Schemas:

Schema schema = new Schema();
Element element = new Element("note");
schema.addElement(element);
ComplexType complexType = new ComplexType();
element.addComplexType();
Sequence sequence = new Sequence();
complexType.addSequence(sequence);
sequence.addElement(new Element("to"));
...
SomeXmlSchemaCreatorUtility.createXmlSchemaFile(new File("C:\myschema.xsd"), schema);

With the above kind of code (though, with the addition of some namespaces handling too) I would like to be able to create a schema file with this content:
<?xml version="1.0"?>

Somehow, I really expect that it should be possible to create a schema with WSDL4J (or is it really useful with an API for creating WSDL without also being able to create Xml Schemas ?), kind of like this:

javax.wsdl.Definition wsdlDef = ...
wsdlDef.addSchema(schema);
// the above schema object was created as further above,
// however there is no addSchema method in WSDL4J's "javax.wsdl.Definition"
javax.wsdl.xml.WSDLWriter(wsdlDef, outputStream);

/ Tom

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nana001
Offline
Joined: 2008-05-25
Points: 0

[*][url=http://www.51cnnet.net/ebook/171-beyond-java]Beyond Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/394-ajax-on-java]Ajax on Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/531-java-garage]JAVA GARAGE ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/639-java-and-soap]Java and SOAP ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/716-hardcore-java]Hardcore Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/831-java-cryptography]Java Cryptography ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/843-java-and-xslt]Java and XSLT ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/860-java-rmi]Java RMI ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/877-java-nio]Java NIO ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/890-java-cookbook]Java Cookbook ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/914-java-foundations]Java Foundations ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1493-bluetooth-for-java]Bluetooth for Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/87-rails-for-java-developers]Rails for Java Developers ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/192-jython-for-java-programmers]Jython for Java Programmers ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/528-java-reflection-in-action]Java Reflection in Action ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/530-fundamental-networking-in-java]Fundamental Networking in Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/616-java-thread-programming]Java Thread Programming ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/630-java-enterprise-in-a-nutshell]Java Enterprise in a Nutshell ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/739-effective-enterprise-java]Effective Enterprise Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/753-java-generics-and-collections]Java Generics and Collections ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/787-java-concurrency-in-practice]Java Concurrency in Practice ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/808-developing-java-beans]Developing Java Beans ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/855-java-pocket-guide]Java Pocket Guide ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/869-java-management-extensions]Java Management Extensions ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/881-java-web-services]Java Web Services ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/898-java-3d-programming]Java 3D Programming ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/960-pro-ajax-and-java]Pro Ajax and Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1054-developing-games-in-java]Developing Games in Java ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1091-java-programming-on-linux]Java Programming on Linux ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1163-c-for-java-programmers]C# For Java Programmers ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1276-java-data-objects]Java Data Objects ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1279-java-message-service]Java Message Service ebook free download[/url]
[*][url=http://www.51cnnet.net/ebook/1287-java-performance-tuning]Java Performance Tuning ebook free download[/url]