You mentioned wscompile, which was wsdl to java tool in JAX-RPC. If you
are using JAX-WS RI 2.1.1 and beyond, you should not see this problem,
provided your endpoint is either WSDL first, where wsimport will
generate @XmlSeeAlso[1] with all the base and sub classes allowing base
classes to be returned.
If it is Java first case, then you need to annotate your endpoint class
with @XmlSeeAlso, for example:
@XmlSeeAlso(PaymentInfo.class, CreditCardPaymentInfo.class)
Similarly you need to run wsimport on your client so that the stub is
generated with @XmlSeeAlso annotations with all the relevant classes.
-vivek.
[1]
https://jax-ws.dev.java.net/nonav/2.1.2m1/docs/UsersGuide.html#2.6.1_Type_Substitution
BJ wrote:
> In my webservice, I have a method called getPaymentInfo() that returns a base
> class PaymentInfo; it can also return CreditCardPaymentInfo class because
> this class extends the PaymenInfo class.
>
> My question is when I call this method, it always return the PaymentInfo
> class and I know for sure it should return CreditCardPaymentInfo class.
>
> I am using wscompile to generate the client stub. Is there any switch in
> wscompile I need to turn on/off to be able to get the right class back.
>
> Thanks in advance.
>