users@jax-rpc.java.net

Re: please help - jaxrpc in jwsdp1.2 fails deserializing base/super class

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Thu, 16 Oct 2003 17:58:34 -0700

Nan,
You may have discovered a bug. Would it be possible for you to
post the entire WSDL you are using?

Thanks

Nan Xiong wrote:
> Hello,
> I have a .NET service that uses an abstract base class, where it properties are [XmlAttribute] annotated, meaning that the properties exposed in this abstract base class are serialized into xml attributes
> instead of xml elements in the soap message by .NET.
>
> I created client files using jwsdp1.2 wscompile with -f:searchschema on, the base class's serializer
> seems understand those are xml attributes (see pasted generated code), but it appears the doDeserialize()
> in the base class never get called at the runtime, the result is that those properties are not get set/deserialized at all on the client side - they are always null.
>
> Same .NET services works properly with a Axis1.1 client.
>
> I pasted some relevant lines from wsdl and wscompile generated files in this email, please let me know
> whether this is a bug in jwsdp, or i some other flags i should used in wscompile? Any workaround for now?
>
> Changing those properties to not [XmlAttribute] annotated, works in jwsdp, but we need this for backward compatibility. If [XmlAttribute] is used in a non base class, it also works on jwsdp.
>
> l can provide more detailed info if needed to.
>
> Thanks in advance!
> Nan
>
> ++++++++++ part of WSDL +++++++++++++++
> <s:complexType name="ProcessElement" abstract="true">
> <s:attribute name="Name" type="s:string" />
> <s:attribute name="Description" type="s:string" />
> </s:complexType>
>
> <s:complexType name="Worklist">
> <s:complexContent mixed="false">
> <s:extension base="s0:ProcessElement">
> <s:sequence>
> <s:element minOccurs="0" maxOccurs="1" name="Template" type="s0:Template" />
> </s:sequence>
> </s:extension>
> </s:complexContent>
> </s:complexType>
>
> ++++++++ part of SOAP response from .NET ++++++++++++
> <Worklist Name="WFSERVE" Description="Default Process Agent"><Template Name="WFTASK" Description="WFTASK"><Fields><Field Name="STATUS" Description="Status"><Displayed>false</Displayed><Type>Short</Type><Label>Status</Label><ColumnLabel>Status</ColumnLabel><Width>0</Width><ColumnWidth>4</ColumnWidth></Field><Field Name=":REQID" Description="Request ID"><Displayed>true</Displayed><Type>Integer</Type><Label>Request ID</Label><ColumnLabel>Request ID</ColumnLabel><Width>0</Width><ColumnWidth>11</ColumnWidth></Field><Field Name=":TSKTYPE" Description="Task Type"><Displayed>true</Displayed><Type>String</Type><Label>Task Type</Label><ColumnLabel>Task Type</ColumnLabel><Width>10</Width><ColumnWidth>10</ColumnWidth></Field><Field Name=":TSKNAME" Description="Task Name"><Displayed>true</Displayed><Type>String</Type><Label>Task Name</Label><ColumnLabel>Task Name</ColumnLabel><Width>10</Width><ColumnWidth>11</ColumnWidth></Field><Field Name=":PRIORITY" Description="Priority"><Displayed
>true</Displayed><Type>Integer</Type><Label>Priority</Label><ColumnLabel>Priority</ColumnLabel><Width>0</Width><ColumnWidth>8</ColumnWidth></Field><Field Name=":ASYNC" Description="Async"><Displayed>true</Displayed><Type>String</Type><Label>Async</Label><ColumnLabel>Async</ColumnLabel><Width>1</Width><ColumnWidth>5</ColumnWidth></Field><Field Name="RECID" Description="Record ID"><Displayed>false</Displayed><Type>Integer</Type><Label>Record ID</Label><ColumnLabel>Record ID</ColumnLabel><Width>0</Width><ColumnWidth>0</ColumnWidth></Field><Field Name="QUEID" Description="Queue ID"><Displayed>false</Displayed><Type>Integer</Type><Label>Queue ID</Label><ColumnLabel>Queue ID</ColumnLabel><Width>0</Width><ColumnWidth>0</ColumnWidth></Field><Field Name="CPFILE" Description="Filename"><Displayed>false</Displayed><Type>AllCap</Type><Label>Filename</Label><ColumnLabel>Filename</ColumnLabel><Width>80</Width><ColumnWidth>0</ColumnWidth></Field></Fields></Template></Worklist>
>
> +++++++++ doDeserialize() in the subclass WorkList_LiteralSerializer ++++++++
> public Object doDeserialize(XMLReader reader,
> SOAPDeserializationContext context) throws Exception {
> com.viewstar.webservices.Worklist instance = new com.viewstar.webservices.Worklist();
> Object member=null;
> QName elementName;
> List values;
> Object value;
>
> reader.nextElementContent();
> elementName = reader.getName();
> if (reader.getState() == XMLReader.START) {
> if (elementName.equals(ns1_Template_QNAME)) {
> member = ns1_myTemplate_LiteralSerializer.deserialize(ns1_Template_QNAME, reader, context);
> if (member == null) {
> throw new DeserializationException("literal.unexpectedNull");
> }
> instance.setTemplate((com.viewstar.webservices.Template)member);
> reader.nextElementContent();
> }
> }
>
> XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
> return (Object)instance;
> }
>
> ++++++++ doDeserialize() in the base class ProcessElement_LiteralSerializer +++++++++
> public Object doDeserialize(XMLReader reader,
> SOAPDeserializationContext context) throws Exception {
> com.viewstar.webservices.ProcessElement instance = new com.viewstar.webservices.ProcessElement();
> Object member=null;
> QName elementName;
> List values;
> Object value;
>
> Attributes attributes = reader.getAttributes();
> String attribute = null;
> attribute = attributes.getValue(ns3_Name_QNAME);
> if (attribute != null) {
> member = XSDStringEncoder.getInstance().stringToObject(attribute, reader);
> instance.setName((java.lang.String)member);
> }
> attribute = attributes.getValue(ns3_Description_QNAME);
> if (attribute != null) {
> member = XSDStringEncoder.getInstance().stringToObject(attribute, reader);
> instance.setDescription((java.lang.String)member);
> }
>
> reader.nextElementContent();
> XMLReaderUtil.verifyReaderState(reader, XMLReader.END);
> return (Object)instance;
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>


-- 
Doug Kohlert
Java Software Division
Sun Microsystems, Inc.
phone: 503 345-9806
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net