Re-generating code for only one xsd

2007-06-17 Thread Spike Mulligan

I'm working with Axis2(ADB) to generate server code for a WSDL with includes
to multiple schema files.  Particular files undergo regular extensions and
changes while others are much more stable.  My question is that when a
change occurs to a particular file am I able to regenerate only the code for
the schema that changed or can I only regenerate it for the whole WSDL?


Re: (AXIS2 + wsdl2java + XMLBeans) + polymorphism = classcast exception

2007-06-14 Thread Spike Mulligan

Okay, after a week of working on trying to get a WSDL that fits the problem
and that Axis2 would accept, I finally got a working solution.

Apparently using multiple namespaces and substitution groups were messing me
up.  When I restricted myself to the use of include rather than import and
extending completypes rather than substituition groups, suddenly my
generated server code started behaving (it still doesn't support
abstract=true, but that's not hard to fix by hand in the code.


So I was still able to have the file structure:

   WSDL
/   \
  /   \
/   \
device1.xsd device2.xsd
   \/
 \   /
  \ /
abstracttypes.xsd



and to have types in device1.xsd and device2.xsd which inheiret(via
extension) from a common type in abstracttypes.xsd.  This made Axis2
generate server code which could parse incoming soap messages
polymorphically i.e. it gave a class for device1 or for device2 depending on
the xsi:type of the element.

It will be nice when Axis2 supports import and substitution groups together
with these other features--it took me a long time to find a solution since
so many standard features are not or not fully supported.



On 6/13/07, Jacob Danner <[EMAIL PROTECTED]> wrote:


Hey Spike,
Could you try running this scenario oustide of Axis (ie, just add a
main method or something). I think you might be hitting this issue
http://issues.apache.org/jira/browse/XMLBEANS-329
which is actually a dupe of
https://issues.apache.org/jira/browse/AXIS2-2578
as it only appears when using the axis container. In other words can
we attempt to repro this using only xmlbeans?
Thanks,
-Jacob Danner

On 6/13/07, Spike Mulligan <[EMAIL PROTECTED]> wrote:
> So that link seems to imply that Axis2 doesn't support substitution
groups
> and I have to tweak the generated code to support them.
>
> I understand that if they were using ADB to do their binding.  But I'm
> running wsdl2java with the -u xmlbeans option!  Xmlbeans is supposed to
> support ALL features of schemas.  Shouldn't the code it generates for
the
> parent element know how to identify and parse inheiriting elements???
>
>
>
> On 6/12/07, Martin Gainty <[EMAIL PROTECTED]> wrote:
> >
> >
> > Mr Mulligan--
> >
> > is discussed here
> >
>
http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200405.mbox/[EMAIL 
PROTECTED]
> > I dont see where you are setting the xmlType for your typeDesc before
> associating the SubstitutionGroupMember as in
> > typeDesc.setXmlType(new
> QName("urn:","DerivedFromFooType"));
> >
> > ?
> > M-
> > This email message and any files transmitted with it contain
confidential
> > information intended only for the person(s) to whom this email message
is
> > addressed.  If you have received this email message in error, please
> notify
> > the sender immediately by telephone or email and destroy the original
> > message without making a copy.  Thank you.
> >
> >
> >
> > - Original Message -
> > From: Spike Mulligan
> > To: axis-user@ws.apache.org
> > Sent: Tuesday, June 12, 2007 9:34 AM
> > Subject: (AXIS2 + wsdl2java + XMLBeans) + polymorphism = classcast
> exception
> >
> > Does anyone know why the generated code is giving me classcast
exceptions?
> >
> > I'm using substitutionGroups + complextype extension to implement the
> following structure:
> >
> >   TYPES:
>  ELEMENTS OF THOSE TYPES:
> > AbstractAttributeSetType
> AbstractAttributeSet
> >   /\
> /\
> >  /  \ extension
>/  \ subtitutionGroups
> >/  \
>   /  \
> > Type1Type2
> Element1  Element2
> >
> > When I send a soap request with the AbstractAttributeSet it's accepted
> fine,
> >  but when I send Element1 or Element2 it gives me a classcast
exception
> when I do :
> >
> addDevice.getAddDevice
().getAddDeviceInputParam().getAbstractAttributeSet().schemaType().getName().getLocalPart())
> >
> > The exception occurs in getAbstractAttributeSet() in the line target =
> (com.nds.consumermgr.types.AbstractAttributeSetType
)get_store().find_element_user(ABSTRACTATTRIBUTESET$3,
> 0);
> >
> > Why the error?  Is there some special way you're supposed to do this?
> >
> >
> > -- Forwarded message --
> > From: Spike Mulligan < [EMAIL PROTECTED]>
> > Date: Jun 12, 2007 4:21 PM
> > Subject: Fwd: AXIS2 + wsdl2java + XMLBeans not p

Re: (AXIS2 + wsdl2java + XMLBeans) + polymorphism = classcast exception

2007-06-13 Thread Spike Mulligan

So that link seems to imply that Axis2 doesn't support substitution groups
and I have to tweak the generated code to support them.

I understand that if they were using ADB to do their binding.  But I'm
running wsdl2java with the -u xmlbeans option!  Xmlbeans is supposed to
support ALL features of schemas.  Shouldn't the code it generates for the
parent element know how to identify and parse inheiriting elements???



On 6/12/07, Martin Gainty <[EMAIL PROTECTED]> wrote:


 Mr Mulligan--

is discussed here

http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200405.mbox/[EMAIL 
PROTECTED]
I dont see where you are setting the xmlType for your typeDesc before
associating the SubstitutionGroupMember as in
typeDesc.setXmlType(new QName("urn:","DerivedFromFooType"));

?
M-
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please
notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message -
*From:* Spike Mulligan <[EMAIL PROTECTED]>
*To:* axis-user@ws.apache.org
*Sent:* Tuesday, June 12, 2007 9:34 AM
*Subject:* (AXIS2 + wsdl2java + XMLBeans) + polymorphism = classcast
exception

Does anyone know why the generated code is giving me classcast exceptions?

I'm using substitutionGroups + complextype extension to implement the
following structure:

  TYPES:   ELEMENTS OF
THOSE TYPES:
AbstractAttributeSetTypeAbstractAttributeSet
  /\
/\
 /  \ extension
/  \ subtitutionGroups
   /  \ /
\
Type1Type2  Element1  Element2

When I send a soap request with the AbstractAttributeSet it's accepted
fine,
 but when I send Element1 or Element2 it gives me a classcast exception
when I do :
   
addDevice.getAddDevice().getAddDeviceInputParam().getAbstractAttributeSet().schemaType().getName().getLocalPart())


The exception occurs in getAbstractAttributeSet() in the line target = (
com.nds.consumermgr.types.AbstractAttributeSetType)get_store().find_element_user(ABSTRACTATTRIBUTESET$3,
0);

Why the error?  Is there some special way you're supposed to do this?


-- Forwarded message --
From: Spike Mulligan <[EMAIL PROTECTED]>
Date: Jun 12, 2007 4:21 PM
Subject: Fwd: AXIS2 + wsdl2java + XMLBeans not producing correct binding
To: [EMAIL PROTECTED]


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?





On 6/11/07, Mohana Ramaratnam <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> *Sent:* Monday, June 11, 2007 9:55 AM
> *To:* [EMAIL PROTECTED]
> *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* <[EMAIL PROTECTED]> wrote:
>
> I think you can invoke the method schemaType to check the xsiType
>
>
>  --
>
> *From:* Spike Mulligan [mailto: [EMAIL PROTECTED]
> *Sent:* Monday, June 11, 2007 7:48 AM
> *To:* [EMAIL PROTECTED]
> *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* <[EMAIL PR

(AXIS2 + wsdl2java + XMLBeans) + polymorphism = classcast exception

2007-06-12 Thread Spike Mulligan

Does anyone know why the generated code is giving me classcast exceptions?

I'm using substitutionGroups + complextype extension to implement the
following structure:

 TYPES:   ELEMENTS OF THOSE
TYPES:
AbstractAttributeSetTypeAbstractAttributeSet
 /\
/\
/  \ extension  /
\ subtitutionGroups
  /  \
/
\
Type1Type2  Element1  Element2

When I send a soap request with the AbstractAttributeSet it's accepted fine,
but when I send Element1 or Element2 it gives me a classcast exception when
I do:
  
addDevice.getAddDevice().getAddDeviceInputParam().getAbstractAttributeSet().schemaType().getName().getLocalPart())


The exception occurs in getAbstractAttributeSet() in the line target = (
com.nds.consumermgr.types.AbstractAttributeSetType)get_store().find_element_user(ABSTRACTATTRIBUTESET$3,
0);

Why the error?  Is there some special way you're supposed to do this?


-- Forwarded message ------
From: Spike Mulligan <[EMAIL PROTECTED]>
Date: Jun 12, 2007 4:21 PM
Subject: Fwd: AXIS2 + wsdl2java + XMLBeans not producing correct binding
To: [EMAIL PROTECTED]


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?





On 6/11/07, Mohana Ramaratnam <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
*Sent:* Monday, June 11, 2007 9:55 AM
*To:* [EMAIL PROTECTED]
*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* <[EMAIL PROTECTED]> wrote:

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


 ------

*From:* Spike Mulligan [mailto: [EMAIL PROTECTED]
*Sent:* Monday, June 11, 2007 7:48 AM
*To:* [EMAIL PROTECTED]
*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* <[EMAIL PROTECTED] > wrote:

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



Mohana


 --

*From:* Spike Mulligan [mailto: [EMAIL PROTECTED]
*Sent:* Monday, June 11, 2007 5:29 AM
*To:* [EMAIL PROTECTED]
*Subject:* AXIS2 + wsdl2java + XMLBeans not producing correct binding





So I have a schema containing the following structure:

AbstractType
  /\
 /  \ extension
   /  \
Type1Type2


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?







AXIS2 + wsdl2java + XMLBeans not producing correct binding

2007-06-11 Thread Spike Mulligan

So I have a schema containing the following structure:

AbstractType
 /\
/  \ extension
  /  \
Type1Type2


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?  What am I doing wrong?


wsdl2java renames imported schemas

2007-06-10 Thread Spike Mulligan

I noticed that when I run wsdl2java on my wsds it renames all the imported
schemas xsd0.xsd xsd1.xsd rather than my nice meaningful names.  How do I
get it to preserve the original names?