2011-05-04 43 views
0

余米使用KSOAP。但我发现了以下错误调用PHP Web服务如何在android中调用php webseviece?

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <root>@1:47 in [email protected]) 

在m改变我的名字空间和动作名称它给结束标记的错误plz帮助我米,我的工作和填充有罪感到困惑ABT这个简单problem.help我..

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 envelope = 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(); 
    } 

在m调试谈到对resultRequestsoap应用它提供了以下错误org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <root>@1:47 in [email protected])

+0

请检查您的命名空间,METHODNAME从WSDL和也正确的网址获得价值与否。 – 2011-05-04 06:23:55

回答