beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <>
Subject Re: wsdl/schema generation and custom type mapping
Date Sun, 07 Aug 2005 21:37:59 GMT

thank you for your great and extensive answer!

if i understand the xmlbeans way correctly, i would have to define
all of the types with a schema?
or would it be possible to define the common types with a schema,
generate the java classes, and write the other domain objects directly
in java?

what is the difference to implementing the getTypeDesc, getSerializer
and getDeserializer for these common types?

btw: i yet tried to implement these three static methods for the
common types, but noticed that this is not enough.
i had to implement these methods in the referencing types
(in the given example, i had to specify the XmlType with the custom
namespace for WSConsumerInfo in the referencing MyWS1Request
and MyWS2Request) to get the common type in the correct namespace
but this means, that i have to write serialization information for each
request object, so i could even write the schema by hand.

i thought the basic approach of beehive (or annotations more
generically) is to have only one artifact that is edited by
the developer.
so would expect to do as much as possible in java what otherwise
would have been done in several files (deployment descriptors like

currently, i'm a little bit confused if my aims are kind of strange,
or if in fact it's the best thing to write schema by hand and
start from this.
i really wonder why there's no straight forward way in writing
webservice in plain old java. aren't annotations the thing that
would enable us to achieve this?

thanx for your help,

On Sun, 2005-08-07 at 11:03 -0700, Daryoush Mehrtash wrote:
> Martin,
> Beehive supports three different types in a Web Service.
>      1. POJO
>      2. XMLBean types
>      3. Axis types
> If you use a POJO as your type,  beehive would introspect the class
> and create its  type mappings.  It makes your life easier since the
> introspection walks up the class hierarchy and is smart enough to
> recognise other Axis or XMLBean types along the way.   In this case if
> you use a same type in two different web services (with different
> default namespace) you would get different schema.  Which is not what
> you want.
> The other two alternative (Axis types, and XMLBeans) on the other hand
> expect the types to do their own serializations.  In both of these
> cases  you would be able to get your desired effect, i.e. to reuse the
> type and still get the same schema. 
> XMLBean types are always generated from schema.  They would be an
> ideal case if you want to start the web service development by
> defining the schema of the types.  You would write your schema and use
> XMLBean tools to generate the types and then use the types in your web
> services.  You can also take this one step further by using an XML
> editor to  first write the complete WSDL (types, messages, port,
> binding..) then use beehive to generate your types and the annotated
> web service class.  (see samples/wsm-addressbook-fromWSDL).
> Your other Alternative is to use Axis types.  You would need this if
> you are using RPC style, or if you want to have fine grain control
> over the serialization process.  You can either write them by hand or
> use Axis tools to generate the types.   This is documented here:
> Note that you would only need the data types that are generated. To
> write them by hand you would need to implement the three public static
> methods (getTypeDesc, getSerailizer, and getDeserailizer)  for each
> type.  I attached an example  for StateType class that  was generated
> by Axis tools, it should give you an idea what you would need to
> implement.  You can drop this class in any JWS, and you should see the
> type being serialized to http://byXmlBeanNS (just a name i used when i
> created the type)  namespace.  Axis also has tools to generate the
> Helper classes that do serialization (see Axis documentation for more
> on this).
> To summarize....  If you are doing RPC style, then use the Axis types
> (either generated or by hand).  If you are using Document style then
> use XMLBeans if you know the schema of the types, or use Axis types if
> you want to start from Java  and write your own serialization.
> Hope this helps.
> Daryoush
> On 8/7/05, Martin Grotzke <> wrote:
>         hello,
>         what would you think of an additional annotation for the
>         webservice class like @TypeMapping that provides properties
>         like the wsdd-typemapping?
>         i know that this has nothing to do with jsr181 but with axis, 
>         but this would be a way to achive more flexibility (concerning
>         things that normally would be done via wsdd)...
>         would this be possible from a technical point of view, and
>         would
>         you integrate things like this into beehive? 
>         or what would be the way for customization?
>         cheers,
>         martin
>         On Sun, 2005-08-07 at 14:17 +0200, Martin Grotzke wrote:
>         > hello,
>         >
>         > i'm using beehive for writing some webservices, and like it
>         very 
>         > much!
>         >
>         > now i want to have a custom type mapping for one class that
>         is used
>         > by more that one webservice in common, but i do not know how
>         to do
>         > this.
>         >
>         > what i have is the following: 
>         >
>         >
>         >   (this is a class that provides information about the
>         webservice
>         >   consumer, this is expected by all webservices)
>         >
>         > 
>         > (associates WSConsumerInfo)
>         >
>         >
>         > (associates WSConsumerInfo)
>         >
>         > both webservices define their own targetNamespace, e.g.
>         > "" and "".
>         >
>         > when the wsdl for a service is generated, the serializer
>         creates 
>         > only the namespace for the service, and the WSConsumerInfo
>         is
>         > created in the same namespace. so, each webservice gets it's
>         own
>         > WSConsumerInfo, what is not desired, because the client's
>         shall
>         > get the WSConsumerInfo as a shared concept, too. 
>         > i'd like to have the WSConsumerInfo generated in a common
>         namespace
>         > "".
>         >
>         > is there any way to achieve this with beehive?
>         >
>         > thanx for your help,
>         > cheers,
>         > martin
>         >
>         >
>         --
>         Martin Grotzke
>         Hohenesch 38, 22765 Hamburg
>         Tel.      +49 (0) 40.39905668
>         Mobil     +49 (0) 170.9365656
>         E-Mail
>         Online
>         -----BEGIN PGP SIGNATURE-----
>         Version: GnuPG v1.4.1 (GNU/Linux)
>         iD8DBQBC9jSS7FvOl7Te+pYRAuBCAJwPkUSm+dw1h7k
>         ++srrivAfxwIEPACgncgv 
>         oVPdxZeypr4wH5Ndf2Yg4FA=
>         =xYUK
>         -----END PGP SIGNATURE-----
Martin Grotzke
Hohenesch 38, 22765 Hamburg
Tel.      +49 (0) 40.39905668
Mobil     +49 (0) 170.9365656

View raw message