开发者

How to call php webseviece in android?

开发者 https://www.devze.com 2023-03-02 21:29 出处:网络
I m calling php webservice using ksoap .but i getting the following error org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:STA

I m calling php webservice using ksoap .but i getting the following error

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <root>@1:47 in java.io.InputStreamReader@44df46b0) 

When m changing my name space and action name it gives error of ending tag plz help me m getting confused with my work and filling guilty abt this simple problem.help me..

String NAMESPACE = "http://www.abc.com/abc";
//String URL =  " http://local/abc_webservice/webservice.php?op=login";
//String SOAP_ACTION = "http://local/abc_webservice/webservice.php/login";
//String METHOD_NAME = "login"  

 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
 request.addProperty("edtUserEmailValue",edtemailid.getText().toString());
 request.addProperty("edtUserPasswordValue",edtpaswword.getText().toString());

SoapSerializationEnvelope 开发者_如何学Goenvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);

SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
SoapObject loginValue =(SoapObject)resultsRequestSOAP.getProperty(0); 
result=loginValue.getProperty("Result").toString();
EmailAddress=loginValue.getProperty("EmailAddress").toString();

String res1="Success";
    if(result.equals(res1)){
           UserID =Integer.parseInt(loginValue.getProperty("UserID").toString());
           startActivity(new Intent(Sign.this,Peoplynearby.class));
      }else{
          displayAlert();
      }
      //Toast.makeText(getBaseContext(), loginValue,Toast.LENGTH_LONG).show();
   }catch(NumberFormatException e){
      //Toast.makeText(getBaseContext(),e.toString(),Toast.LENGTH_SHORT).show();
   }catch(Exception e){ 
      e.printStackTrace();
     //Toast.makeText(getBaseContext(),e.toString(),Toast.LENGTH_SHORT).show();
   }

When m debug the app it comes on resultRequestsoap it gives following error org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <root>@1:47 in java.io.InputStreamReader@44df46b0)


Take a look at the following Article.

http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/

0

精彩评论

暂无评论...
验证码 换一张
取 消