Re: Deserializing substitutionGroup and abstract types

2007-01-30 Thread Amy Krause

Hi,


Abstract types and substitution groups seem not to be well supported
in most web service machinery.  Even if you find a supporting
platform, there may be interoperability problems if clients use other
platforms.


That's interesting. I wasn't aware of that.


You might have an easier time getting something like this
to work:

element name=sequence type=tns:Workflow/
element name=parallel type=tns:Workflow/
element name=pipeline type=tns:Pipeline/

complexType name=Workflow
 choice maxOccurs=unbounded
element ref=sequence/
element ref=parallel/
element ref=pipeline/
  /choice
/complexType

complexType name=Pipeline
 ...
/complexType



This is a far more elegant way of writing the schema, I agree - it's what 
I originally used. Unfortunately, WSDL2Java (Axis 1.4) doesn't seem to 
support the maxOccurs attribute on a choice element. The beans don't 
reflect it, there's only one member in the Java bean for each of the 
subelements.
It is a complicated problem. Since the sequence, parallel and 
pipeline elements can occur in any order and multiplicity the bean would 
have to provide a List containing those objects. But then those objects 
need to be cast to the correct types ...

This is why I tried to use substitutionGroups.

Is there any other way of solving the problem? I hope I was wrong and it's 
possible to generate beans for the choice maxOccurs=unbounded  ... 
solution.


Amy





On 1/29/07, Amy Krause [EMAIL PROTECTED] wrote:

Hi,

I'm having a very similar problem as described here:
http://marc.theaimsgroup.com/?l=axis-userm=113819830006177w=2

My schema is included below.
I'm trying to implement a composite pattern. There are three types derived
from an abstract type as follows:

 Workflow (abstract)
/ |\
Parallel   Sequence  Pipeline

Both parallel and sequence elements must contain nested Workflow elements
(one or more of parallel, sequence or pipeline), whereas pipeline elements
cannot - they form the leaves of the workflow tree.
An example of a document would be:

perform
   sequence
 parallel
   pipeline ... /pipeline
   pipeline ... /pipeline
 /parallel
 pipeline ... /pipeline
   /sequence
perform

In the schema I've defined an abstract Workflow element and elements
parallel, sequence and pipeline. These are substitution elements for the
Workflow element.
When I generate Java beans with WSDL2Java there is no trace of the
parallel and sequence elements. There is a Java class called Composite
which extends WorkflowComponent but there is no way of telling whether
this Composite object used to be a sequence or a parallel element. How can
I force Axis to generate Java beans corresponding to those elements?

Any help with this would be appreciated.

Thanks,
Amy



  !-- root element --
  xsd:element name=perform
 xsd:complexType
   xsd:sequence
 xsd:element ref=tns:workflow/
   /xsd:sequence
 /xsd:complexType
   /xsd:element

   !-- work flow group and component --

   xsd:element name=workflow abstract=true
type=tns:WorkflowComponent
   /xsd:element

   xsd:complexType name=WorkflowComponent
   /xsd:complexType

   xsd:element name=parallel
substitutionGroup=tns:workflow
type=tns:Composite/
   xsd:element name=sequence
substitutionGroup=tns:workflow
type=tns:Composite/

   xsd:complexType name=Composite
 xsd:complexContent
   xsd:extension base=tns:WorkflowComponent
 xsd:sequence
   xsd:element ref=tns:workflow maxOccurs=unbounded/
 /xsd:sequence
   /xsd:extension
 /xsd:complexContent
   /xsd:complexType

   xsd:element name=pipeline
substitutionGroup=tns:workflow
type=tns:Pipeline/

   xsd:complexType name=Pipeline
 xsd:complexContent
   xsd:extension base=tns:WorkflowComponent
 xsd:sequence
   xsd:element ref=tns:activity minOccurs=1
   maxOccurs=unbounded/
 /xsd:sequence
   /xsd:extension
 /xsd:complexContent
   /xsd:complexType

   xsd:element name=activity
  !-- some definitions here ... --
   /xsd:element


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








--
  
 | Dr Amy Krause  Applications Consultant |
 ||epcc|, The University of Edinburgh |
 | King's Buildings, Mayfield Road, Edinburgh EH9 3JZ, UK |
 | Tel: +44 (0)131 650 6718 --- email: [EMAIL PROTECTED

Deserializing substitutionGroup and abstract types

2007-01-29 Thread Amy Krause

Hi,

I'm having a very similar problem as described here:
http://marc.theaimsgroup.com/?l=axis-userm=113819830006177w=2

My schema is included below.
I'm trying to implement a composite pattern. There are three types derived 
from an abstract type as follows:


Workflow (abstract)
   / |\
   Parallel   Sequence  Pipeline

Both parallel and sequence elements must contain nested Workflow elements 
(one or more of parallel, sequence or pipeline), whereas pipeline elements 
cannot - they form the leaves of the workflow tree.

An example of a document would be:

perform
  sequence
parallel
  pipeline ... /pipeline
  pipeline ... /pipeline
/parallel
pipeline ... /pipeline
  /sequence
perform

In the schema I've defined an abstract Workflow element and elements 
parallel, sequence and pipeline. These are substitution elements for the 
Workflow element.
When I generate Java beans with WSDL2Java there is no trace of the 
parallel and sequence elements. There is a Java class called Composite 
which extends WorkflowComponent but there is no way of telling whether 
this Composite object used to be a sequence or a parallel element. How can 
I force Axis to generate Java beans corresponding to those elements?


Any help with this would be appreciated.

Thanks,
Amy



 !-- root element --
 xsd:element name=perform
xsd:complexType
  xsd:sequence
xsd:element ref=tns:workflow/
  /xsd:sequence
/xsd:complexType
  /xsd:element

  !-- work flow group and component --

  xsd:element name=workflow abstract=true
   type=tns:WorkflowComponent
  /xsd:element

  xsd:complexType name=WorkflowComponent
  /xsd:complexType

  xsd:element name=parallel
   substitutionGroup=tns:workflow
   type=tns:Composite/
  xsd:element name=sequence
   substitutionGroup=tns:workflow
   type=tns:Composite/

  xsd:complexType name=Composite
xsd:complexContent
  xsd:extension base=tns:WorkflowComponent
xsd:sequence
  xsd:element ref=tns:workflow maxOccurs=unbounded/
/xsd:sequence
  /xsd:extension
/xsd:complexContent
  /xsd:complexType

  xsd:element name=pipeline
   substitutionGroup=tns:workflow
   type=tns:Pipeline/

  xsd:complexType name=Pipeline
xsd:complexContent
  xsd:extension base=tns:WorkflowComponent
xsd:sequence
  xsd:element ref=tns:activity minOccurs=1
  maxOccurs=unbounded/
/xsd:sequence
  /xsd:extension
/xsd:complexContent
  /xsd:complexType

  xsd:element name=activity
 !-- some definitions here ... --
  /xsd:element


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]