WebService generation and polymorphic behavior

I have a simple problem.
Class A has an attribute of type Class B
Class B has 2 subclasses, Class C and Class D.
(it holds only a reference to Class B, but at runtime will be assigned
instances of Class C and Class D).
Lets say Stateless EJB has a method called getMyClassA() : Class A
The servicegen tool will not generate mappings or serializers/deserializers
for Class C and Class D because they are not referenced directly
(statically) from within serialized chain of classes. If I make a fake
(unused) attribute in Class A of type Class C and Class D, everything is
created and all works fine.
I tried to use the <autotype> and <source2wsdd> but I need to run then it
twice. Once with the EJB interface, and once with the supporting classes
(class C & D). Unfortunately I then have to manually merge the 2 deployment
descriptors because the <source2wsdd> task doesn't support the
"mergeWithExistingWs" attribute as specified in the documentation.
Has anybody encountered this problem?
Thanks,
Mark

When I upgraded to 8.1 from the beta it seemed to magically work!
Thanks,
Mark
"manoj cheenath" <[email protected]> wrote in message
news:[email protected]...
Thanks for trying out my suggestion.
It looks like the problem is because you are
using 8.1beta. WLS 8.1 GA is available for
download. Please try it out.
I wrote an example similar to your usecase
and it seems to work fine in WLS 8.1.
Checkout the example attached.
Regards,
-manoj
http://manojc.com
"Mark Fine" <[email protected]> wrote in message
news:[email protected]...
Yes, i'm using the WLS8.1beta.
Originally, I was using the "copied.xml" file. That does not "merge".
It
works as stated in the autotype documentation, it excludes the types
specified in the "typeMapping" file so the new types.xml file onlycontains
types that are not in the "copied.xml" file.
The source2wsdd task is needed to merge two deployment descriptors intoone,
but unfortunately the documented parameter "mergeExistingWS" doesn't
work
in
8.1 (documented bug).
Is there any workaround for this other than manually merging thedeployment
descriptors.
M
"manoj cheenath" <[email protected]> wrote in message
news:[email protected]...
You are using WLS 8.1?
Also can you please try the secound autotype with
the copied.xml file. I suspect that the old types.xml
file is overwritten before loading it.
<autotype
javaComponents="${service.class}"
targetNamespace="${webservice.machine.url}"
destDir="${autotype.dir}"
typeMappingFile="${autotype.dir}/copied.xml"
>I have not tried this type of example. So this is a
wild guess :-)
Regards,
-manoj
http://manojc.com
"Mark Fine" <[email protected]> wrote in message
news:[email protected]...
I tried running autotype for both class C & D, and for the EJB. It
simply
overwrites the first types.xml.
To confirm the problem I copied the result of autotype C & D to aseparate
file and saw that its contents were not merged.
Here are my tasks:
<autotype
javatypes="C, D"
targetNamespace="${webservice.machine.url}"
destDir="${autotype.dir}">
<classpath>
<path refid="webservice-build-classpath" />
<pathelement location="${autotype.dir}" />
</classpath>
</autotype>
<copy tofile="${autotype.dir}/copied.xml"
file="${autotype.dir}/types.xml"/>
<autotype
javaComponents="${service.class}"
targetNamespace="${webservice.machine.url}"
destDir="${autotype.dir}"
typeMappingFile="${autotype.dir}/types.xml"
>
<classpath>
<path refid="webservice-build-classpath" />
<pathelement location="${autotype.dir}" />
</classpath>
</autotype>
"manoj cheenath" <[email protected]> wrote in message
news:[email protected]...
In 8.1 you can run autotype on class C and D to generate
the types.xml file. Then run autotype on the ejb interface
by passing in the types.xml file generated before. The
secound autotype should merge the type.xml files. I have
not tried this out, but a similar example is here.
http://www.manojc.com/?sample8
Regards,
-manoj
http://manojc.com
"Mark Fine" <[email protected]> wrote in message
news:[email protected]...
I have a simple problem.
Class A has an attribute of type Class B
Class B has 2 subclasses, Class C and Class D.
(it holds only a reference to Class B, but at runtime will be
assigned
instances of Class C and Class D).
Lets say Stateless EJB has a method called getMyClassA() : Class
A
>>>>>>
The servicegen tool will not generate mappings orserializers/deserializers
for Class C and Class D because they are not referenced directly
(statically) from within serialized chain of classes. If I make
a
fake
(unused) attribute in Class A of type Class C and Class D,
everything
is
created and all works fine.
I tried to use the <autotype> and <source2wsdd> but I need to
run
then
it
twice. Once with the EJB interface, and once with the
supporting
classes
(class C & D). Unfortunately I then have to manually merge the
2
deployment
descriptors because the <source2wsdd> task doesn't support the
"mergeWithExistingWs" attribute as specified in the
documentation.
>>>>>>
Has anybody encountered this problem?
Thanks,
Mark

Similar Messages

Maybe you are looking for