You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Spike Mulligan <sp...@gmail.com> on 2007/06/11 12:28:53 UTC

AXIS2 + wsdl2java + XMLBeans not producing correct binding

So I have a schema containing the following structure:

AbstractType
      /    \
     /      \     extension
   /          \
Type1    Type2


When I send the service an instance of Type1 for example using
xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
generated and which extends the AbstractType class).

Instead it gives me a class of type AbstractType!

Has anyone successfully done this?  Does it work?  Is this the expected
behaviour of XML beans?  What am I doing wrong?

Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Spike Mulligan <sp...@gmail.com>.
SchemaType can only be done on the document--my abstract type is higher up.

I can do .schemaType().getName() but that still just gives me the abstract
parent type.  There must be some way to get at the inheiriting type!

What if I was doing an xs:choice--would how would I get at the specific
type?   Or does it already give me the correct class?

On 6/11/07, Mohana Ramaratnam <mo...@npg.wustl.edu> wrote:
>
>  I think you can invoke the method schemaType to check the xsiType
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 7:48 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
> Okay, but how do I check at runtime whether its Type1 or Type2?
>
> On 6/11/07, *Mohana Ramaratnam* <mohanar@npg.wustl.edu > wrote:
>
> You will have to use the method changeType and typecast the result back to
> the Type1 class.
>
>
>
> Mohana
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 5:29 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
>
>
> So I have a schema containing the following structure:
>
> AbstractType
>       /    \
>      /      \     extension
>    /          \
> Type1    Type2
>
>
> When I send the service an instance of Type1 for example using
> xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
> generated and which extends the AbstractType class).
>
> Instead it gives me a class of type AbstractType!
>
> Has anyone successfully done this?  Does it work?  Is this the expected
> behaviour of XML beans?  What am I doing wrong?
>
>
>

Fwd: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Spike Mulligan <sp...@gmail.com>.
Right--when I try to do that I get a classcastexception when I use the
inheiriting class.  When I use the abstract parent class then gives me the
name of the element.

I do:
   addDevice.getAddDevice().getAddDeviceInputParam().getAbstractAttributeSet().schemaType().getName().getLocalPart())


The result is a classcastexception in getAbstractAttributeSet() in the line
target = (com.nds.consumermgr.types.AbstractAttributeSetType)get_store().find_element_user(ABSTRACTATTRIBUTESET$3,
0);

So for some reason it doesn't know to get the inheiriting type.

Any ideas?


I'll send you my schema and my sample soap request--maybe you'll see what
I'm doing wrong.


On 6/11/07, Mohana Ramaratnam <mo...@npg.wustl.edu> wrote:
>
>  The way this has been working for me is:
>
>
>
> If (file.schemaType().getName().getLocalPart().equals(
> ImageResource.type.getName().getLocalPart()))
>
>  ImageResource imageResource = (ImageResource)file.changeType(
> ImageResource.type);
>
>
>
> Where file is an object of type AbstractResource and ImageResource extends
> AbstractResource (similar to your case of Type1 extending AbstractType)
>
>
>
> You could check your xmlbeans src to see what the class hierarchy is.
>
>
>
>
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 9:55 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
> Right so checking the schematype gives me the parent type and casting the
> parent type to the inheiriting type gives me a runtime exception.
>
> Have you ever gotten this to work?  Do you think maybe my soap message or
> my xsd may be wrong?
>
> On 6/11/07, *Mohana Ramaratnam* <mo...@npg.wustl.edu> wrote:
>
> I think you can invoke the method schemaType to check the xsiType
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto: spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 7:48 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
> Okay, but how do I check at runtime whether its Type1 or Type2?
>
> On 6/11/07, *Mohana Ramaratnam* <mohanar@npg.wustl.edu > wrote:
>
> You will have to use the method changeType and typecast the result back to
> the Type1 class.
>
>
>
> Mohana
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto: spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 5:29 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
>
>
> So I have a schema containing the following structure:
>
> AbstractType
>       /    \
>      /      \     extension
>    /          \
> Type1    Type2
>
>
> When I send the service an instance of Type1 for example using
> xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
> generated and which extends the AbstractType class).
>
> Instead it gives me a class of type AbstractType!
>
> Has anyone successfully done this?  Does it work?  Is this the expected
> behaviour of XML beans?  What am I doing wrong?
>
>
>
>
>

Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Spike Mulligan <sp...@gmail.com>.
Right--when I try to do that I get a classcastexception when I use the
inheiriting class.  When I use the abstract parent class then gives me the
name of the element.

I do:
   addDevice.getAddDevice
().getAddDeviceInputParam().getAbstractAttributeSet().schemaType().getName().getLocalPart())

The result is a classcastexception in getAbstractAttributeSet() in the line
target = (com.nds.consumermgr.types.AbstractAttributeSetType)get_store().find_element_user(ABSTRACTATTRIBUTESET$3,
0);

So for some reason it doesn't know to get the inheiriting type.

Any ideas?


I'm attaching my schema and my sample soap request--maybe you'll see what
I'm doing wrong.


On 6/11/07, Mohana Ramaratnam <mo...@npg.wustl.edu> wrote:
>
>  The way this has been working for me is:
>
>
>
> If (file.schemaType().getName().getLocalPart().equals(
> ImageResource.type.getName().getLocalPart()))
>
>  ImageResource imageResource = (ImageResource)file.changeType(
> ImageResource.type);
>
>
>
> Where file is an object of type AbstractResource and ImageResource extends
> AbstractResource (similar to your case of Type1 extending AbstractType)
>
>
>
> You could check your xmlbeans src to see what the class hierarchy is.
>
>
>
>
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 9:55 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
> Right so checking the schematype gives me the parent type and casting the
> parent type to the inheiriting type gives me a runtime exception.
>
> Have you ever gotten this to work?  Do you think maybe my soap message or
> my xsd may be wrong?
>
> On 6/11/07, *Mohana Ramaratnam* <mo...@npg.wustl.edu> wrote:
>
> I think you can invoke the method schemaType to check the xsiType
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 7:48 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
> Okay, but how do I check at runtime whether its Type1 or Type2?
>
> On 6/11/07, *Mohana Ramaratnam* <mohanar@npg.wustl.edu > wrote:
>
> You will have to use the method changeType and typecast the result back to
> the Type1 class.
>
>
>
> Mohana
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto: spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 5:29 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
>
>
> So I have a schema containing the following structure:
>
> AbstractType
>       /    \
>      /      \     extension
>    /          \
> Type1    Type2
>
>
> When I send the service an instance of Type1 for example using
> xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
> generated and which extends the AbstractType class).
>
> Instead it gives me a class of type AbstractType!
>
> Has anyone successfully done this?  Does it work?  Is this the expected
> behaviour of XML beans?  What am I doing wrong?
>
>
>
>
>

RE: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Mohana Ramaratnam <mo...@npg.wustl.edu>.
The way this has been working for me is:

 

If
(file.schemaType().getName().getLocalPart().equals(ImageResource.type.ge
tName().getLocalPart())) 

 ImageResource imageResource =
(ImageResource)file.changeType(ImageResource.type);

 

Where file is an object of type AbstractResource and ImageResource
extends AbstractResource (similar to your case of Type1 extending
AbstractType)

 

You could check your xmlbeans src to see what the class hierarchy is. 

 

 

 

________________________________

From: Spike Mulligan [mailto:spikemulligan44@gmail.com] 
Sent: Monday, June 11, 2007 9:55 AM
To: user@xmlbeans.apache.org
Subject: Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

 

Right so checking the schematype gives me the parent type and casting
the parent type to the inheiriting type gives me a runtime exception.

Have you ever gotten this to work?  Do you think maybe my soap message
or my xsd may be wrong? 

On 6/11/07, Mohana Ramaratnam <mo...@npg.wustl.edu> wrote:

I think you can invoke the method schemaType to check the xsiType

 

________________________________

From: Spike Mulligan [mailto:spikemulligan44@gmail.com] 
Sent: Monday, June 11, 2007 7:48 AM
To: user@xmlbeans.apache.org
Subject: Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

 

Okay, but how do I check at runtime whether its Type1 or Type2?

On 6/11/07, Mohana Ramaratnam <mohanar@npg.wustl.edu > wrote:

You will have to use the method changeType and typecast the result back
to the Type1 class. 

 

Mohana

 

________________________________

From: Spike Mulligan [mailto: spikemulligan44@gmail.com] 
Sent: Monday, June 11, 2007 5:29 AM
To: user@xmlbeans.apache.org
Subject: AXIS2 + wsdl2java + XMLBeans not producing correct binding

 



So I have a schema containing the following structure:

AbstractType
      /    \
     /      \     extension
   /          \
Type1    Type2


When I send the service an instance of Type1 for example using
xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
generated and which extends the AbstractType class). 

Instead it gives me a class of type AbstractType!

Has anyone successfully done this?  Does it work?  Is this the expected
behaviour of XML beans?  What am I doing wrong?

 

 


Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Spike Mulligan <sp...@gmail.com>.
Right so checking the schematype gives me the parent type and casting the
parent type to the inheiriting type gives me a runtime exception.

Have you ever gotten this to work?  Do you think maybe my soap message or my
xsd may be wrong?

On 6/11/07, Mohana Ramaratnam <mo...@npg.wustl.edu> wrote:
>
>  I think you can invoke the method schemaType to check the xsiType
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 7:48 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
> Okay, but how do I check at runtime whether its Type1 or Type2?
>
> On 6/11/07, *Mohana Ramaratnam* <mohanar@npg.wustl.edu > wrote:
>
> You will have to use the method changeType and typecast the result back to
> the Type1 class.
>
>
>
> Mohana
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 5:29 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
>
>
> So I have a schema containing the following structure:
>
> AbstractType
>       /    \
>      /      \     extension
>    /          \
> Type1    Type2
>
>
> When I send the service an instance of Type1 for example using
> xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
> generated and which extends the AbstractType class).
>
> Instead it gives me a class of type AbstractType!
>
> Has anyone successfully done this?  Does it work?  Is this the expected
> behaviour of XML beans?  What am I doing wrong?
>
>
>

RE: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Mohana Ramaratnam <mo...@npg.wustl.edu>.
I think you can invoke the method schemaType to check the xsiType

 

________________________________

From: Spike Mulligan [mailto:spikemulligan44@gmail.com] 
Sent: Monday, June 11, 2007 7:48 AM
To: user@xmlbeans.apache.org
Subject: Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

 

Okay, but how do I check at runtime whether its Type1 or Type2?

On 6/11/07, Mohana Ramaratnam <mohanar@npg.wustl.edu > wrote:

You will have to use the method changeType and typecast the result back
to the Type1 class. 

 

Mohana

 

________________________________

From: Spike Mulligan [mailto:spikemulligan44@gmail.com] 
Sent: Monday, June 11, 2007 5:29 AM
To: user@xmlbeans.apache.org
Subject: AXIS2 + wsdl2java + XMLBeans not producing correct binding

 



So I have a schema containing the following structure:

AbstractType
      /    \
     /      \     extension
   /          \
Type1    Type2


When I send the service an instance of Type1 for example using
xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
generated and which extends the AbstractType class). 

Instead it gives me a class of type AbstractType!

Has anyone successfully done this?  Does it work?  Is this the expected
behaviour of XML beans?  What am I doing wrong?

 


Re: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Spike Mulligan <sp...@gmail.com>.
Okay, but how do I check at runtime whether its Type1 or Type2?

On 6/11/07, Mohana Ramaratnam <mo...@npg.wustl.edu> wrote:
>
>  You will have to use the method changeType and typecast the result back
> to the Type1 class.
>
>
>
> Mohana
>
>
>  ------------------------------
>
> *From:* Spike Mulligan [mailto:spikemulligan44@gmail.com]
> *Sent:* Monday, June 11, 2007 5:29 AM
> *To:* user@xmlbeans.apache.org
> *Subject:* AXIS2 + wsdl2java + XMLBeans not producing correct binding
>
>
>
>
>
> So I have a schema containing the following structure:
>
> AbstractType
>       /    \
>      /      \     extension
>    /          \
> Type1    Type2
>
>
> When I send the service an instance of Type1 for example using
> xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
> generated and which extends the AbstractType class).
>
> Instead it gives me a class of type AbstractType!
>
> Has anyone successfully done this?  Does it work?  Is this the expected
> behaviour of XML beans?  What am I doing wrong?
>

RE: AXIS2 + wsdl2java + XMLBeans not producing correct binding

Posted by Mohana Ramaratnam <mo...@npg.wustl.edu>.
You will have to use the method changeType and typecast the result back
to the Type1 class. 

 

Mohana

 

________________________________

From: Spike Mulligan [mailto:spikemulligan44@gmail.com] 
Sent: Monday, June 11, 2007 5:29 AM
To: user@xmlbeans.apache.org
Subject: AXIS2 + wsdl2java + XMLBeans not producing correct binding

 



So I have a schema containing the following structure:

AbstractType
      /    \
     /      \     extension
   /          \
Type1    Type2


When I send the service an instance of Type1 for example using
xsi:type="ns1:Type1", it should give me the Type1 class(which wsdl2java
generated and which extends the AbstractType class). 

Instead it gives me a class of type AbstractType!

Has anyone successfully done this?  Does it work?  Is this the expected
behaviour of XML beans?  What am I doing wrong?