Re: Bug??

Stefan Haustein <[email protected]> Wed, 16 Apr 2003 15:37:10 +0200
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
Hi Wolfgang,

can you describe the problem you observed in more detail, perhaps attach 
the exception and an XML code example?

The precondition for readUnknown is that its sitting on the start tag of 
the unknown object. if next() was moved down, the method would not be 
able to recognize primitive content  (text strings, numbers).

Best,
Stefan


Wolfgang Beer wrote:
> Hi there,
> 
> I had a problem with the kSOAP2 class SoapSerializationEnvelope. When i 
> was parsing SOAP envelopes with it
> it was not possible to parse SoapCalls with empty msg bodys in it!
> I checked the parseBody method of class SoapSerializationEnvelope and 
> the call to method readUnknown(...).
> 
> I think the problem lies in the very early call of parser.next() in line 
> 4. It cant read the start tag
> of the unknown object because it is already set to the start object, so 
> it fails.
> If i put the parser.next() call after the SoapObject is created it works 
> well:
> 
> protected Object readUnknown(XmlPullParser parser, String typeNamespace, 
> String typeName)
>                                         throws IOException, 
> XmlPullParserException {
>         String name = parser.getName ();
>         String namespace = parser.getNamespace();
>         // parser.next() original position
>      Object result = null;
>         String text = null;
> 
>      if (parser.getEventType() == XmlPullParser.TEXT) {
>         text = parser.getText();
>            result = new SoapPrimitive(typeNamespace, typeName, text);
>            parser.next();
>      }
>         if (parser.getEventType() == XmlPullParser.START_TAG) {
>         if (text != null && text.trim().length() != 0)
>                 throw new RuntimeException("Malformed input: Mixed 
> content");
> 
>      SoapObject so = new SoapObject(typeNamespace, typeName);
>         parser.next(); // parser.next() new position??
>      while (parser.getEventType() != XmlPullParser.END_TAG) {
>         //...
>         //...
>         //...
> //...
> 
> please somebody could answer my question if this is a bug or i didnt 
> realize how it should work...
> 
> best greetings
> Wolfgang
> 
> _______________________________________________
> Ksoap mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/ksoap