Bug??

Wolfgang Beer <[email protected]> Tue, 15 Apr 2003 15:27:57 +0200
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
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