You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kr <ba...@gmail.com> on 2005/09/14 13:56:12 UTC

Any tools for converting java class to xml schema ?

Hi,

Are there any tools out there that can convert my java class to xml schema. 
How such tools take care of java collections like HashTable, ArrayList
etc. in my class structure.  I am not interested in writing any
configuration files(like jaxb configuration files,  jibx binding xml
files etc.) for serving this purpose and the can be able to give me
xml  schema from the java classes. Please suggest ...

I am not sure even JAXB 2.0 allows me to do this without writing any
jaxb configuration files or annotations in my java class which is not
there in JDK 1.4.2


Thanks & Regards,
Kr.

Re: Any tools for converting java class to xml schema ?

Posted by robert burrell donkin <ro...@gmail.com>.
On 9/19/05, Kr <ba...@gmail.com> wrote:
> Hi Robert,
> 
> Your site is very interesting. I have packaged class and how do I feed
> it to your tool at http://people.apache.org/~rdonkin/tool.html ? since
> even if I keep my class in classpath your tool is not able to
> recognize it . 

the code is just intended to work as a design aid (we were talking
about various approaches to developing mappings visually) rather than
as functional software.

the applets are part of an import phase where basic reusable mappings
would be created for objects and then saved into a library. a second
mapping phase would allow advanced mappings to be developed against
given schema and is described in other design documents.

the problem with the prototype is that it uses betwixt (which - as a
dynamic binder - is well suited to fast prototyping) and has no output
facility so it's just a toy. i am keen to try to create a proper
application along the lines discussed but there's quite a bit of work
that's needed. if it happens, it'll be open sourced somewhere (though
not sure exactly where). be a while before it'd be ready for users.
(be a bit different if you were interested in helping to develop it.)

> Also how the tool take care of java collections like
> java.util.Hashtable's 

i call these collective mappings. a key question is how (and whether)
they are typed.

betwixt is bean-centric. it extends the concept of properties to
collective properties. adders are guessing using plural stemming
(getItems/addItem). this allows a type to be guessed.

jibx does less guessing (since it is field-centric) so you specify
everything. see
http://jibx.sourceforge.net/tutorial/binding-collects.html.

more thought is needed for collections with arbitrary contents. not
very easy to support (need a dynamic binder) and quite probably not
really worth the effort. polymorphic collections (multiple specified
sub-types) are more reasonable.

> and java.util.HashMap' etc.? 

jibx takes the very reasonable approach that there is not natural
mapping.  betwixt guesses a reasonable mapping and tries to match a
putter to a getter.

this is the area where a good tool would be invaluable: it's a lot of
work to have to specify in detail (ala jibx) but there isn't a single
natural strategy. the problem with betwixt's introspection is that
though the strategies make it flexible, they are too complex to learn
easily. a visual tool could show the likely results and improve the
speed at which mappings could be created (whether through jibx or
betwixt).

> Please execuse me
> if my knowledge is trivial.

it's not trivial: start from java has more than a few wrinkles and
there are not very people who know much about it.

- robert

Re: Any tools for converting java class to xml schema ?

Posted by robert burrell donkin <ro...@gmail.com>.
On 9/14/05, Kr <ba...@gmail.com> wrote:
> Hi,
> 
> Are there any tools out there that can convert my java class to xml schema.
> How such tools take care of java collections like HashTable, ArrayList
> etc. in my class structure.  I am not interested in writing any
> configuration files(like jaxb configuration files,  jibx binding xml
> files etc.) for serving this purpose and the can be able to give me
> xml  schema from the java classes. Please suggest ...
> 
> I am not sure even JAXB 2.0 allows me to do this without writing any
> jaxb configuration files or annotations in my java class which is not
> there in JDK 1.4.2

the start-from-java approach (to xml-object mapping) maps java classes
to xml. many start java tools can create xml schemas which describe
the resultant xml. there are a number of tools that will do this with
minimal configuration. however, to get good schema customization of
the mapping is usually required.

(if you're happy with mapping fields then take look at
http://jibx.sourceforge.net/.
http://jakarta.apache.org/commons/betwixt/ is a bean based approach
but is also a dynamic mapper (which means that it is slow) with
experimental schema support.)

we were talking about this problem on this list a while ago. the
consensus is that one missing feature is a good gui tool which would
assist this process and generate the detailed mappings used by the
engine.

might not be much use for you ATM but if you're interested in the
start-from-java problem i posted some doodlings based on the
discussions here:

http://people.apache.org/~rdonkin/tool/mapping1.html
http://people.apache.org/~rdonkin/tool/tune.html
http://people.apache.org/~rdonkin/tool.html

- robert

Re: Any tools for converting java class to xml schema ?

Posted by Kr <ba...@gmail.com>.
Hi Steve,

Thank you for the response. I agree with you but looking for tools in
environments where people are not aware of soap toolkits like AXIS or
when we dont have any tools like JAVA2WSDL etc. Is it possible atleast
with latest version of JAXB ?

Thanks & Regards,
Kr.


On 9/14/05, Steve Loughran <st...@apache.org> wrote:
> Kr wrote:
> > Hi,
> >
> > Are there any tools out there that can convert my java class to xml schema.
> > How such tools take care of java collections like HashTable, ArrayList
> > etc. in my class structure.  I am not interested in writing any
> > configuration files(like jaxb configuration files,  jibx binding xml
> > files etc.) for serving this purpose and the can be able to give me
> > xml  schema from the java classes. Please suggest ...
> >
> > I am not sure even JAXB 2.0 allows me to do this without writing any
> > jaxb configuration files or annotations in my java class which is not
> > there in JDK 1.4.2
> >
> 
> The problem with this approach is that while there are things that take
> your code and generate XSD/WSDL from it, you end up with unstable WSDL that
>  -changes whenever you change a bit of your implementation
>  -changes whenever you upgrade your soap stack
>  -is invariably really hard to work with at the far end
>  -is inherently uportable
> 
> I would recommend embracing XSD, even though it is a painful language to
> use, because at some point in your project you will be staring at
> XSD/WSDL Files trying to manually change them so that everything works.
> You only have a choice when that staring begins -early on in the project
> or the week the system goes live, and how well you know XSD by the time
> that integration begins...
>

Re: Any tools for converting java class to xml schema ?

Posted by Kr <ba...@gmail.com>.
Hi Steve,

Thank you for the response. I agree with you but looking for tools in
environments where people are not aware of soap toolkits like AXIS or
when we dont have any tools like JAVA2WSDL etc. Is it possible atleast
with latest version of JAXB ?

Thanks & Regards,
Kr.


On 9/14/05, Steve Loughran <st...@apache.org> wrote:
> Kr wrote:
> > Hi,
> >
> > Are there any tools out there that can convert my java class to xml schema.
> > How such tools take care of java collections like HashTable, ArrayList
> > etc. in my class structure.  I am not interested in writing any
> > configuration files(like jaxb configuration files,  jibx binding xml
> > files etc.) for serving this purpose and the can be able to give me
> > xml  schema from the java classes. Please suggest ...
> >
> > I am not sure even JAXB 2.0 allows me to do this without writing any
> > jaxb configuration files or annotations in my java class which is not
> > there in JDK 1.4.2
> >
> 
> The problem with this approach is that while there are things that take
> your code and generate XSD/WSDL from it, you end up with unstable WSDL that
>  -changes whenever you change a bit of your implementation
>  -changes whenever you upgrade your soap stack
>  -is invariably really hard to work with at the far end
>  -is inherently uportable
> 
> I would recommend embracing XSD, even though it is a painful language to
> use, because at some point in your project you will be staring at
> XSD/WSDL Files trying to manually change them so that everything works.
> You only have a choice when that staring begins -early on in the project
> or the week the system goes live, and how well you know XSD by the time
> that integration begins...
>

Re: Any tools for converting java class to xml schema ?

Posted by Steve Loughran <st...@apache.org>.
Kr wrote:
> Hi,
> 
> Are there any tools out there that can convert my java class to xml schema. 
> How such tools take care of java collections like HashTable, ArrayList
> etc. in my class structure.  I am not interested in writing any
> configuration files(like jaxb configuration files,  jibx binding xml
> files etc.) for serving this purpose and the can be able to give me
> xml  schema from the java classes. Please suggest ...
> 
> I am not sure even JAXB 2.0 allows me to do this without writing any
> jaxb configuration files or annotations in my java class which is not
> there in JDK 1.4.2
> 

The problem with this approach is that while there are things that take 
your code and generate XSD/WSDL from it, you end up with unstable WSDL that
  -changes whenever you change a bit of your implementation
  -changes whenever you upgrade your soap stack
  -is invariably really hard to work with at the far end
  -is inherently uportable

I would recommend embracing XSD, even though it is a painful language to 
use, because at some point in your project you will be staring at 
XSD/WSDL Files trying to manually change them so that everything works. 
You only have a choice when that staring begins -early on in the project 
or the week the system goes live, and how well you know XSD by the time 
that integration begins...