On Mon, Jul 21, 2008 at 8:26 AM, Matt Wlazlo <[EMAIL PROTECTED]> wrote:
> Hi, > > I'm having trouble with passing inheritance types. I've followed this > url: > http://www.ibm.com/developerworks/websphere/techjournal/0401_brown/brown.html > as a guide to WSDL inheritance, and everything seems to be working > except that when it comes time to do a typecast, there doesn't appear > to be any relationship of the objects... > > I think it will be easier to explain the situation in code: > > In my WSDL I have the following: > > <simpleType name="idType"> > <restriction base="xsd:string"> > <enumeration value="INFNUM" /> > <enumeration value="SESSNUM" /> > <enumeration value="CLIENTCD" /> > </restriction> > </simpleType> > <complexType name="idSet"> > <sequence> > <element maxOccurs="1" minOccurs="1" name="idtype" > type="xsd1:idType" /> > <element maxOccurs="1" minOccurs="1" name="idvalue" > type="xsd:string" /> > </sequence> > </complexType> > <complexType name="idSetSess"> > <complexContent> > <extension base="xsd1:idSet"> > <sequence> > <element name="seqNum" type="xsd:string" /> > </sequence> > </extension> > </complexContent> > </complexType> > ............. > ............. > <element name="get"> > <complexType> > <sequence> > <element minOccurs="1" maxOccurs="unbounded" > name="id" > nillable="true" type="xsd1:idSet" /> > </sequence> > </complexType> > </element> > > > Then in my server code (the error is here): > public get(IdSet[] ids) { > ... > for(int i = 0; i < id.length; i++) { > IdSet id = ids[i]; > if(id.getIdtype() == IdType.SESSNUM) { > if(!(id instanceof IdSetSess)) > throw new Exception("IdSetSess not used when IdType set to > SESSNUM!"); // XXX id should be an instance of IdSetSess > ..... > ..... > } > } > } > > On the wire, an example request is: > <soapenv:Envelope xmlns:soapenv=" > http://schemas.xmlsoap.org/soap/envelope/"> > <soapenv:Body> > <xsd:get xmlns:xsd="http://osr.nsw.gov.au/pillar/gen/xsd"> > <xsd:id xsi:type="xsd:idSetSess" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <xsd:idtype>SESSNUM</xsd:idtype> > <xsd:idvalue>20004465</xsd:idvalue> > <xsd:seqNum>141</xsd:seqNum> > </xsd:id> > <xsd:id> > <xsd:idtype>INFNUM</xsd:idtype> > <xsd:idvalue>7151999517</xsd:idvalue> > </xsd:id> > </xsd:get> > </soapenv:Body> > </soapenv:Envelope> > > > > The request on the wire looks to be to be OK. The expression "id > instanceof IdSetSess" is always false, whereas I would expect it to be > true. > > Do I need to do something special to be able to cast an IdSet to an > IdSetSess? Is this even possible? > > > Cheers, > Matt. > > > -- > Reclaim your digital rights, eliminate DRM, learn more at > http://www.defectivebydesign.org/what_is_drm > > -----BEGIN GEEK CODE BLOCK----- > Version: 3.12 > GCS d--- s: a C++++ UL+++ P+++ L+++++ E--- W++ N o-- K- w-- > O M+ V PS+++ PE Y PGP t+ 5 X++ R !tv b+++ DI+ D++ > G-- e++ h+ r+ y+++++ > ------END GEEK CODE BLOCK------ > > > Today's lucky number is: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > What is the Axis version you use? Axis1.x or Axis2.x thanks, Amila. -- Amila Suriarachchi, WSO2 Inc.
