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 "J.P. Leibundguth" <jl...@yahoo.com> on 2004/02/18 15:38:47 UTC

Experience with Custom Serializers and WSDL

All of my data types are represented by my own
serializers and deserializers.  Now that they are
finished, I'd like to get the WSDL generation going
for those custom types.  Does anyone have experience
with any of the following:

1) Currently the WSDL Axis generates has all of my
methods, but no type descriptions.  I know there is a
way to supply the WSDL, but I don't want to
exhaustively write method descriptions all over again,
I just want to supply the type descriptions.  Is there
a way to do this via a single file in the
server-config.wsdd?

2) If the above doesn't work, is there a way to upload
these types using the writeSchema methods?  Mine
currently returns null.  I noticed that the Types
class has a method for loadSchemaTypes().  Can this
just be used as is?  Is the assumption here that the
serializer only loads a single type for the object
type it represents or does it load multiple?

3) If that way doesn't work, is there any
documentation on how to properly build up the WSDL
using the other calls in the Types class?

Thanks!
J.P.

Re: Experience with Custom Serializers and WSDL

Posted by Joseph Dane <jd...@hawaii.edu>.
I have only recently started using Axis, so I'm not sure if I'm even
understanding your question correctly.  but it sounds like you're
trying to do something I just did yesterday.

I had written a Java interface with a bunch of methods.  The
arguments and return values of the methods were either simple Java
types, or one of two bean types I had also written.  I found that
running the java2wsdl ant task didn't generate XML schema definitions
for my bean types.

After poking around in the source, I found what appears to be an
undocumented feature of the java2wsdl ant task.  I'm using the
current CVS code, so that may be why it's undocumented.  could be I'm
using it wrong, or that there's no plans on making this feature
public, or whatever.

anyhow, you can include <complexType> elements inside the java2wsdl
task.  these just map a Java class to a namespace.  you can also
specify [de]serializers, although in my case the default bean
serializer was fine.  the task looks something like this:

    <java2wsdl classname=' ... '
	       namespace='http://services.hawaii.edu/...'
	       style='document'
	       use='encoded'>
      <classpath>
	<path refid='cp'/>
	<pathelement location='hawaii-service.jar'/>
      </classpath>
      <mapping namespace='http://services.hawaii.edu/technews'
	       package='hawaii.service.technews'/>
      <complexType namespace='http://services.hawaii.edu/technews'
		   classname='hawaii.service.technews.Item'/>
      <complexType namespace='http://services.hawaii.edu/technews'
		   classname='hawaii.service.technews.Update'/>
    </java2wsdl>

one strange thing I encountered: even though all the Java classes
(the interface and the beans) were in the jar file listed above, ant
couldn't find the bean classes.  I had to set my global (shell)
CLASSPATH to include the jar file to get the generation to work.

HTH,

-- 

joe