This turns out to be a bug in VectorSerializer, it never checks /
de-references the hrefs. I've attached a patch.

John, one final tweak you'll need to your pocketSOAP client code, is
when setting the brand property, to wrap the values in a CLng call, as
the Apache end doesn't do type promotions. e.g.

brandMasterValue.Nodes.Create "brand", Clng(1)
this will force the serialized value to be typed as xsd:int, matching
what the bean deserializer is expecting.

Cheers
Simon
www.pocketsoap.com

On Thu, 17 Jan 2002 16:30:56 -0500, in soap you wrote:

>I'm writing a SOAP service using ApacheSOAP 2.2 that is communicating with a
>PocketPC client. The pocket PC is using PocketSOAP  www.pocketSOAP.com to
>generate the following request:
>
>
>POST /soap/servlet/rpcrouter HTTP/1.0
>Content-Type: text/xml; charset=UTF-8
>Accept-Charset: UTF-8, UTF-16
>User-Agent: pocketSOAP/1.2.1
>Host: 10.2.32.46:8080
>Content-Length: 1049
>SOAPAction:
>
><S:Envelope
>       S:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
>       xmlns:E='http://schemas.xmlsoap.org/soap/encoding/'
>       xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'
>       xmlns:c='http://www.w3.org/2001/XMLSchema'
>       xmlns:b='http://www.w3.org/2001/XMLSchema-instance'
>       xmlns:a='urn:BrandMasterService'>
><S:Body><a:putBrandMasterValues><Vector href='#23333c'/>
></a:putBrandMasterValues>
><a:BrandMasterValue E:root='0' id='233dd4'
>b:type='a:BrandMasterValue'><brand b:type='c:short'>2</brand>
><brandDescShort b:type='c:string'>SHORT2</brandDescShort>
><brandDescLong b:type='c:string'>LONG2</brandDescLong>
></a:BrandMasterValue>
><a:BrandMasterValue E:root='0' id='23365c'
>b:type='a:BrandMasterValue'><brand b:type='c:short'>1</brand>
><brandDescShort b:type='c:string'>SHORT1</brandDescShort>
><brandDescLong b:type='c:string'>LONG1</brandDescLong>
></a:BrandMasterValue>
><a:Vector E:root='0' id='23333c' b:type='a:Vector'><BrandMasterValue
>href='#23365c'/>
><BrandMasterValue href='#233dd4'/>
></a:Vector>
></S:Body></S:Envelope>
>
>
>Apache states that it couldn't find the MIME attachment:
>
>
>
>HTTP/1.1 500 Internal Server Error
>Date: Thu, 17 Jan 2002 21:19:06 GMT
>Server: Oracle9iAS (1.0.2.2) Containers for J2EE
>Content-Length: 542
>Set-Cookie: JSESSIONID=NJJPLKNFELII; Path=/
>Cache-Control: private
>Connection: Close
>Content-Type: text/xml; charset=utf-8
>
><?xml version='1.0' encoding='UTF-8'?>
><SOAP-ENV:Envelope
>xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
>xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
>xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
><SOAP-ENV:Body>
><SOAP-ENV:Fault>
><faultcode>SOAP-ENV:Client</faultcode>
><faultstring>Attachment tag "BrandMasterValue" refers to a Mime attachment
>with label "#23365c" which could not be found.</faultstring>
><faultactor>/soap/servlet/rpcrouter</faultactor>
></SOAP-ENV:Fault>
>
></SOAP-ENV:Body>
></SOAP-ENV:Envelope>
>
>
>Any help would be appreciated,
>
>John

Index: VectorSerializer.java
===================================================================
RCS file: 
/home/cvspublic/xml-soap/java/src/org/apache/soap/encoding/soapenc/VectorSerializer.java,v
retrieving revision 1.7
diff -u -r1.7 VectorSerializer.java
--- VectorSerializer.java       6 Sep 2001 20:34:17 -0000       1.7
+++ VectorSerializer.java       18 Jan 2002 05:15:00 -0000
@@ -180,11 +180,24 @@
                  String actualEncStyle = declEncStyle != null
                                                                  ? declEncStyle
                                                                        : 
inScopeEncStyle;
-          QName declItemType = SoapEncUtils.getTypeQName(tempEl);
+
+                 // If it's a local reference, follow it.
+         String href = tempEl.getAttribute(Constants.ATTR_REFERENCE);
+         Element actualEl = tempEl;
+                 if(href != null && !href.equals("") && (href.charAt(0) == '#'))
+         {
+               href = href.substring(1);
+               actualEl = 
+DOMUtils.getElementByID(src.getOwnerDocument().getDocumentElement(),href);
+               if (actualEl == null) {
+                 throw new IllegalArgumentException("No such ID '" + href + "'");
+            }
+          }
+                                                                       
+          QName declItemType = SoapEncUtils.getTypeQName(actualEl);
           QName actualItemType = declItemType;
 
-                  Bean itemBean = xjmr.unmarshall(actualEncStyle, actualItemType,
-                                                  tempEl, ctx);
+          Bean itemBean = xjmr.unmarshall(actualEncStyle, actualItemType,
+                                                  actualEl, ctx);
 
                  v.addElement(itemBean.value);
 

Reply via email to