axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@us.ibm.com
Subject RE: Problems with "sequence maxOccurs='unbounded' " in WSDL types def intion
Date Mon, 12 Aug 2002 22:11:55 GMT
Glen said:
As it stands, it appears we ignore the actual semantics of the <choice>,
and make a regular multi-field bean!  Am I missing something?

Correct.  And I agree that the serializer would need to introspect to
determine how to serialize the value.  Also need to throw an exception in
the set methods (or change the deserializer) to make sure that the choices
are set correctly.

I wish that JSR 101 had defined a mapping!

Rich Scheuerle
IBM WebSphere & Axis Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                         
                                       
                      Glen Daniels                                                       
                                       
                      <gdaniels@macrome        To:       "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
                  
                      dia.com>                 cc:                                    
                                          
                                               Subject:  RE: Problems with "sequence maxOccurs='unbounded'
" in WSDL types       
                      07/30/2002 10:35              def intion                           
                                       
                      AM                                                                 
                                       
                      Please respond to                                                  
                                       
                      axis-dev                                                           
                                       
                                                                                         
                                       
                                                                                         
                                       



I hadn't realized there was choice support yet... cool!

We don't do them right, though.  A choice should, perhaps, look something
like this (pseudocoded):

public class ChoiceBean {
    private static final QName QNAME_A = new QName("", "A");
    private static final QName QNAME_B = new QName("", "B");

    private Object value;  // only one value, not multiple
    private QName which; // tells us which element this is

    public Object getValue() {
        return value;
    }

    public int getAsA() {
        if (which != QNAME_A)
            throw something;
        return value == null : 0 : ((Integer)value).getIntValue();
    }

    public String getAsB() {
        if (which != QNAME_B)
            throw something;
        return (String)value;
    }

    public void setAsA(int i) {
        which = QNAME_A;
        value = new Integer(i);
    }

    public void setAsB(String s) {
        which = QNAME_B;
        value = s;
    }
}

Then the serializer needs to have some knowledge of this as well, so it can
serialize the "value" object as the correct QName.

As it stands, it appears we ignore the actual semantics of the <choice>,
and make a regular multi-field bean!  Am I missing something?

--Glen
 -----Original Message-----
 From: butek@us.ibm.com [mailto:butek@us.ibm.com]
 Sent: Tuesday, July 30, 2002 9:50 AM
 To: axis-dev@xml.apache.org
 Subject: RE: Problems with "sequence maxOccurs='unbounded' " in WSDL types
 def intion

 Glen, we DO support complexType choices - see
 test/wsdl/types/ComprehensiveTypes.wsdl - but we don't support maxOccurs
 on a <sequence> element.

 Russell Butek
 butek@us.ibm.com



 Please respond to axis-dev@xml.apache.org


 To: "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
 cc:
 Subject: RE: Problems with "sequence maxOccurs='unbounded' " in WSDL types
 def intion




 Hi Werner!

 Your WSDL files points out a couple of things we don't deal with yet in
 Axis.  In particular, I don't think we support maxOccurs on a <sequence>
 element itself (though we do on <element>s inside it).  We also do not
 handle <choice> elements yet.

 Could you submit this WSDL in a bugzilla bug report?  I think it's pretty
 critical that we begin to support this stuff soon.

 Thanks!
 --Glen

 > -----Original Message-----
 > From: Dittmann Werner [mailto:Werner.Dittmann@icn.siemens.de]
 > Sent: Tuesday, July 30, 2002 2:28 AM
 > To: 'axis-dev@xml.apache.org'
 > Subject: Problems with "sequence maxOccurs='unbounded' " in WSDL types
 > def intion
 >
 >
 > Hi,
 >
 > while playing/testing with Axis I used the following WSDL file to
 > generate stubs, skeletons etc. Please look at the "sequence" statement
 > in the complexType "idxType". The idea is to have the block
 > enclosed by
 > the sequence as an array.
 > I didn't get any complaints during the WSDL2Java run but looking at
 > the generated code I couldn't figure out how to set the sequence
 > part more then once.
 > Because of the definitions in the WSDL type section I expected to
 > find an array of the "sequence" defined in idxType because it is
 > defined as unbounded.  Did I made somthing wrong or is
 > it a known problem or yet unsupported in Axis?
 >
 > <?xml version='1.0' encoding='UTF-8'?>
 >
 > <definitions name='forTest'
 >   targetNamespace="urn:Ops" xmlns:tns="urn:Ops"
 >   xmlns:srv="urn:service"
 >   xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
 >   xmlns:xsd='http://www.w3.org/2001/XMLSchema'
 >   xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
 >   xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
 >   xmlns='http://schemas.xmlsoap.org/wsdl/'>
 >
 >   <types>
 >     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 >       targetNamespace="urn:service" xmlns:tns="urn:service"
 >       version="1.0" xml:lang="EN">
 >
 > <xsd:complexType name="Range">
 >  <xsd:sequence>
 >    <xsd:element name="START" type="xsd:integer"/>
 >    <xsd:element name="STOP" type="xsd:integer"/>
 >    </xsd:sequence>
 > </xsd:complexType>
 >
 > <xsd:complexType name="idxType">
 >   <xsd:sequence minOccurs="1" maxOccurs="unbounded">
 >     <xsd:choice>
 > <xsd:element name="SINGLE" type="xsd:integer"/>
 > <xsd:element name="RANGE" type="tns:Range"/>
 >     </xsd:choice>
 > <xsd:element name="ARRAY" type="xsd:string"
 >  minOccurs="0"/>
 >   </xsd:sequence>
 > </xsd:complexType>
 >     </xsd:schema>
 >   </types>
 >
 >   <message name='Data'>
 >     <part name='dataParam' type='srv:idxType' />
 >   </message>
 >
 >   <message name='dataResponse'/>
 >
 >   <portType name='dataPortType'>
 >     <operation name='getData'>
 >       <input  name='idxData'  message='tns:Data'/>
 >       <output name='outData'  message='tns:DataResponse'/>
 >     </operation>
 >   </portType>
 >
 >   <binding name='dataBinding' type='tns:dataPortType'>
 >     <soap:binding style='rpc'
 >       transport='http://schemas.xmlsoap.org/soap/http'/>
 >     <operation name='getData'>
 >       <soap:operation soapAction='getData' style='rpc' />
 >       <input name='idxData'>
 >         <soap:body use='encoded'
 >  encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
 >    namespace="urn:Ops" />
 >       </input>
 >       <output name='outData'>
 >         <soap:body use='encoded'
 >  encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
 >       </output>
 >     </operation>
 >   </binding>
 >
 >   <service name="DataService">
 >     <port name="dataPort" binding="tns:dataBinding">
 >       <soap:address
 > location="http://localhost:8090/axis/servlet/AxisServlet"/>
 >     </port>
 >   </service>
 >
 > </definitions>
 >
 >
 > Tia
 > Werner
 >
 > Werner Dittmann
 > Siemens ICM N PG ES AS TP
 > mailto:Werner.Dittmann@icn.siemens.de
 > Tel: +49(0)89 722 42481/+49(0)172 85 85 245
 >



Mime
View raw message