Hello,
When I use SoapEnvelope.VER11, it works fine, But when I use
SoapEnvelope.VER12, it gives me error:
"org.xmlpull.v1.XmlPullParserException: expected: START_TAG".
This is my code...


import java.io.IOException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;

import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;


import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class MyWebService extends Activity {
        private static final String SOAP_ACTION = "http://your_URL/
your_mathod_name";
        private static final String METHOD_NAME = "your_mathod_name";
        private static final String NAMESPACE = "http://your_URL/";;
        private static final String URL = "http://your_URL/WebService.asmx?
WSDL";
        private Object resultRequestSOAP = null;
        String data = "some data";

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                TextView tv = new TextView(this);
                setContentView(tv);
                try {

                        SoapObject request = new SoapObject(NAMESPACE, 
METHOD_NAME);
                        SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER12);
                        envelope.encodingStyle = 
SoapSerializationEnvelope.ENC2001;
                        envelope.dotNet = true;
                        envelope.setOutputSoapObject(request);
                        request.addProperty(METHOD_NAME, data);
                        envelope.bodyOut = request;
                SoapObject response = null;
                        HttpTransportSE androidHttpTransport = new 
HttpTransportSE(URL);
                androidHttpTransport.call(SOAP_ACTION, envelope);
                        // get the data
                         response = (SoapObject) envelope.bodyIn;

                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (XmlPullParserException e) {
                        // TODO Auto-generated catch block

                        e.printStackTrace();
                }

        }
}

Can u tell me why is this happening with SOAP1.2 ?
Do I need to specify some encoding style for SOAP1.2 ?

Regards,
Pankaj.

On Feb 4, 10:40 am, Kevin Duffey <[email protected]> wrote:
> Like the others said.. it sounds like a starting element is not being found
> before either some text or an end tag. Usually you'll see that error with
> something like:
>
> <node1>
>   </node2>
>   <node3>
>    </node3>
> </node1>
>
> Or
>
> <node1>
> </node1>
>   some text
> <node2>
> </node2>
>
> It ALSO depends on how you are moving thru the xml parser.. if you are using
> parser.next() you are moving one parsing element at a time, which means
> you'll find every possible element including text, tags,white space, etc. If
> you use parser.nextTag() you may skip over that 2nd example text issue and
> find node2 start tag.
>
>
>
> On Wed, Feb 3, 2010 at 2:29 PM, Nicholas Albion <[email protected]> wrote:
> > If you determine that the problem is that the XML (or HTML!) is badly
> > formatted and you have no control over it, you can do something like:
>
> > int n;
> > while( (n = xpp.getNext()) != END_DOCUMENT ) {
> >  try {
> >     // do your parsing element-by-element
> >  } catch( org.xmlpull.v1.XmlPullParserException e ) {} // ignore the
> > exception
> >  } catch( Throwable e ) {
> >     log.warning("error while parsing file: " + e.getMessage();  //
> > you may want to catch any other exceptions and do something about them
> >  }
> > }
>
> > It might not be the most efficient practice to perform the try/catch
> > within the loop, but if somebody else is sending you dodgy XML there
> > might not be anything you can do.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs 
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to