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 Michael Bell <mi...@cms.hu-berlin.de> on 2007/07/23 17:37:38 UTC

ExtensionMapper

Hi,

we create WSDL types with two different schemas - one for common types 
and one for special types. The idea is that we want to implement common 
types in a central place for all of our web services (e.g. common error 
handling).

During the implementation we noticed that Axis2 generates some 
ExtensionMapper classes. The problem is that Axis2 does not generate one 
ExtensionMapper per package. It generates only one filled 
ExtensionMapper per service. So inheritance does not work because the 
java classes have always web service specific code inside.

I noticed that the generated code can be easily splitted into different 
packages. Is there a special reason why there is only one 
ExtensionMapper? I implemented a small Perl script which loads the 
generated ExtensionMapper and generates mappers on a per package base. 
If someone is interested then I can send the script.

Best regards

Michael
-- 
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
michael.bell@cms.hu-berlin.de   D-10099 Berlin
_______________________________________________________________

X.509 CA Certificates / Wurzelzertifikate

http://ra.pki.hu-berlin.de

Re: ExtensionMapper

Posted by Michael Bell <mi...@cms.hu-berlin.de>.
Hi,

Amila Suriarachchi schrieb:

> this is what  I am saying.
> lets say we have two packages p1, p2 and those contain classes c1 and c2 and
> extension mappers are
> em1 and em2.
> 
> And say em1 only refers to classes in p1 package and em2 only refers to p2
> package classes.
> 
> if p2 pacakge classes extens for p1 package class,
> 
> then when refering from p1, (say c1) it won't be able to find the correct
> class since em1 contain only the p1 package classes.

When do this happen? Can you give an example schema? If I have an 
example then I can adopt my script to this problem too and make it more 
robust. My own schemas create no such code.

Best regards

Michael
-- 
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
michael.bell@cms.hu-berlin.de   D-10099 Berlin
_______________________________________________________________

X.509 CA Certificates / Wurzelzertifikate

http://ra.pki.hu-berlin.de

Re: ExtensionMapper

Posted by Amila Suriarachchi <am...@gmail.com>.
On 7/26/07, Michael Bell <mi...@cms.hu-berlin.de> wrote:
>
> Hi,
>
> the problem is that the actual code generation blocks the use of the
> generated packages with common types by different web services because
> the generated ExtensionMappers are not identical if the web services do
> not share all XML/WSDL types.
>
> So it is not possible for me to write some common classes because the
> import of the common packages fails (except that I import all web
> services).


yes that is correct .

Amila Suriarachchi schrieb:
>
> > On 7/23/07, Michael Bell <mi...@cms.hu-berlin.de> wrote:
>
> > this extension mapper is used  in extensions(to support
> polymorphysum).  if
> > the input xml stream contains an
> > xsi:type element then we find the corresponding class from using this.
> >
> > Keeping one extension mapper would make the code generation easy sine we
> > have to find the class only in one place. other wise have to see in all
> the
> > places. you can not say classes in one package has only extended from
> the
> > class in the same package.
>
> I only see calls to the ExtensionMapper from classes which were
> generated for XML types. So it looks easy for me to modify the extension
> mapper in the correct way and place (this is what I do with my script).


I am talking about the  Classes which calls to the Extension mapper.

> if you split the extension mapper class then you have to change the places
> > it refer as well. some times if you only extends classes from the same
> > package this may work. but not a genearalized approach.
>
> The ExtensionMapper is used in the generated type classes. These classes
> can be very easily fixed. My script looks into the classes and modify
> the package of the extension mapper.
>
> I don't understand which external code uses the extension mapper. Can
> you point me to an example please?


this is what  I am saying.
lets say we have two packages p1, p2 and those contain classes c1 and c2 and
extension mappers are
em1 and em2.

And say em1 only refers to classes in p1 package and em2 only refers to p2
package classes.

if p2 pacakge classes extens for p1 package class,

then when refering from p1, (say c1) it won't be able to find the correct
class since em1 contain only the p1 package classes.

Anyway if you tool address this problem please send a patch.
better if you can make it like wsdl2java where user can run from the bin
directory by giving the
source folder (out put folder to wsdl2java).

I'll commit it as a tool.

thanks,
Amila.


Thanks Michael
> --
> _______________________________________________________________
>
> Michael Bell                    Humboldt-Universitaet zu Berlin
>
> Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
> Fax:  +49 (0)30-2093 2704       Unter den Linden 6
> michael.bell@cms.hu-berlin.de   D-10099 Berlin
> _______________________________________________________________
>
> X.509 CA Certificates / Wurzelzertifikate
>
> http://ra.pki.hu-berlin.de
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: ExtensionMapper

Posted by Michael Bell <mi...@cms.hu-berlin.de>.
Hi,

the problem is that the actual code generation blocks the use of the 
generated packages with common types by different web services because 
the generated ExtensionMappers are not identical if the web services do 
not share all XML/WSDL types.

So it is not possible for me to write some common classes because the 
import of the common packages fails (except that I import all web services).

Amila Suriarachchi schrieb:

> On 7/23/07, Michael Bell <mi...@cms.hu-berlin.de> wrote:

> this extension mapper is used  in extensions(to support polymorphysum).  if
> the input xml stream contains an
> xsi:type element then we find the corresponding class from using this.
> 
> Keeping one extension mapper would make the code generation easy sine we
> have to find the class only in one place. other wise have to see in all the
> places. you can not say classes in one package has only extended from the
> class in the same package.

I only see calls to the ExtensionMapper from classes which were 
generated for XML types. So it looks easy for me to modify the extension 
mapper in the correct way and place (this is what I do with my script).

> if you split the extension mapper class then you have to change the places
> it refer as well. some times if you only extends classes from the same
> package this may work. but not a genearalized approach.

The ExtensionMapper is used in the generated type classes. These classes 
can be very easily fixed. My script looks into the classes and modify 
the package of the extension mapper.

I don't understand which external code uses the extension mapper. Can 
you point me to an example please?

Thanks Michael
-- 
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
michael.bell@cms.hu-berlin.de   D-10099 Berlin
_______________________________________________________________

X.509 CA Certificates / Wurzelzertifikate

http://ra.pki.hu-berlin.de

Re: ExtensionMapper

Posted by Amila Suriarachchi <am...@gmail.com>.
On 7/23/07, Michael Bell <mi...@cms.hu-berlin.de> wrote:
>
> Hi,
>
> we create WSDL types with two different schemas - one for common types
> and one for special types. The idea is that we want to implement common
> types in a central place for all of our web services (e.g. common error
> handling).
>
> During the implementation we noticed that Axis2 generates some
> ExtensionMapper classes. The problem is that Axis2 does not generate one
> ExtensionMapper per package. It generates only one filled
> ExtensionMapper per service. So inheritance does not work because the
> java classes have always web service specific code inside.
>
> I noticed that the generated code can be easily splitted into different
> packages. Is there a special reason why there is only one
> ExtensionMapper?


this extension mapper is used  in extensions(to support polymorphysum).  if
the input xml stream contains an
xsi:type element then we find the corresponding class from using this.

Keeping one extension mapper would make the code generation easy sine we
have to find the class only in one place. other wise have to see in all the
places. you can not say classes in one package has only extended from the
class in the same package.

if you split the extension mapper class then you have to change the places
it refer as well. some times if you only extends classes from the same
package this may work. but not a genearalized approach.

Amila.

I implemented a small Perl script which loads the
> generated ExtensionMapper and generates mappers on a per package base.
> If someone is interested then I can send the script.
>
> Best regards
>
> Michael
> --
> _______________________________________________________________
>
> Michael Bell                    Humboldt-Universitaet zu Berlin
>
> Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
> Fax:  +49 (0)30-2093 2704       Unter den Linden 6
> michael.bell@cms.hu-berlin.de   D-10099 Berlin
> _______________________________________________________________
>
> X.509 CA Certificates / Wurzelzertifikate
>
> http://ra.pki.hu-berlin.de
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.