You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by "Wetsig, Brian" <bw...@pesolutions.com> on 2000/11/09 20:49:09 UTC

RE: Vector Deserializer, working

Thanks Matt-
This code did work.  If you copy this into the VectorSerializer's stubbed
out unmarshall method the Vector deserializer works.

 -----Original Message-----
From: 	Matthew Geis [mailto:matthew.geis@instill.com] 
Sent:	Wednesday, November 08, 2000 4:12 PM
To:	'soap-user@xml.apache.org'
Subject:	RE: Vector Deserializer

Brian,
	It turns out I was right the first time around.  Here's the
source.... (get the lastest source from CVS, and it ought to work).

public Bean unmarshall(String inScopeEncStyle, QName elementType, Node src,
                         XMLJavaMappingRegistry xjmr)
    throws IllegalArgumentException
  {
	  Element root = (Element)src;
	  if (SoapEncUtils.isNull(root)) {
		  return new Bean(Vector.class, null);
	  }
	  
	  Vector v = new Vector();
	  
	  Element tempEl = DOMUtils.getFirstChildElement(root);
	  while (tempEl != null) {
		  String declEncStyle = DOMUtils.getAttributeNS(tempEl,
	
Constants.NS_URI_SOAP_ENV, Constants.ATTR_ENCODING_STYLE);
		  String actualEncStyle = declEncStyle != null
								  ?
declEncStyle
									:
inScopeEncStyle;
		  QName declItemType =
SoapEncUtils.getAttributeValue(tempEl,
	
Constants.NS_URI_SCHEMA_XSI, Constants.ATTR_TYPE, "Vector item",
	
false);
		  QName actualItemType = declItemType;

		  Bean itemBean = xjmr.unmarshall(actualEncStyle,
actualItemType, tempEl);

		  v.addElement(itemBean.value);

		  tempEl = DOMUtils.getNextSiblingElement(tempEl);
	  }
	  
	  return new Bean(Vector.class, v);
  }

-----Original Message-----
From: Wetsig, Brian [mailto:bwetsig@pesolutions.com]
Sent: Wednesday, November 08, 2000 3:03 PM
To: 'soap-user@xml.apache.org'
Subject: FW: Vector Deserializer


If I use the BeanSerializer to deserialize the Vector; I get this error:
Unable to retrieve PropertyDescriptor for property 'item' of class 'class
java.util.Vector'.

Generated fault: 


-----Original Message-----
From: 	Wetsig, Brian  
Sent:	Wednesday, November 08, 2000 2:52 PM
To:	'Matthew Geis'
Subject:	RE: Vector Deserializer

Yep, just tried that & I get the same error  -I looked at the
VectorSerializer.java code,
and it appears you can only use it for serializing only, so it looks like
you have to use something different for a deserializer, and the
BeanSerializer doesn't seem to work for that either (deserializing
Vectors).....
-----Original Message-----
From:	Matthew Geis [mailto:matthew.geis@instill.com] 
Sent:	Wednesday, November 08, 2000 2:34 PM
To:	'soap-user@xml.apache.org'
Cc:	'bwetsig@pesolutions.com'
Subject:	RE: Vector Deserializer

Try using the VectorSerializer for both the serializer and the deserializer.
You are currently using BeanSerializer to do the xml2java part.
-----Original Message-----
From:	Wetsig, Brian [mailto:bwetsig@pesolutions.com]
Sent:	Wednesday, November 08, 2000 12:59 PM
To:	soap-user@xml.apache.org
Subject:	Vector Deserializer


Has anyone been able to deserialize a java.util.Vector?
I'm getting this error:
VectorSerializer used for deserialization My descriptor looks like this:
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:xml-soap:Vector" qname="x:vt"
javaType="java.util.Vector"
 
java2XMLClassName="org.apache.soap.encoding.soapenc.VectorSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
...and I'm sending it like this:
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
VectorSerializer vectSer = new VectorSerializer();
    ....
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("urn:xml-soap:Vector", "vt"),
Vector.class, vectSer, beanSer);
    ....
params.addElement(new Parameter("vt", Vector.class,
vt, null));

-Brian