2
我正在嘗試使用kSoap進行android應用程序的登錄。
這裏是我的代碼:使用Ksoap使用Android登錄
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.login = (Button) this.findViewById(R.id.btn_sign_in);
this.login.setOnClickListener(new OnClickListener() {
@Override
// action of button
public void onClick(View v) {
username= (EditText)findViewById(R.id.txt_username);
password= (EditText)findViewById(R.id.txt_password);
String UserName = username.getText().toString();
String Password = password.getText().toString();
SoapObject loginRequest = new SoapObject(NAMESPACE, METHOD_NAME);
loginRequest.addProperty("username", UserName);
loginRequest.addProperty("password", Password);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet=true;
soapEnvelope.setOutputSoapObject(loginRequest);
Log.i("LoginDetail", "Username " + UserName + "Password " + Password);
HttpTransportSE aht = new HttpTransportSE(URL);
aht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
FakeX509TrustManager.allowAllSSL(); // this class may allow SSL
try{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
Log.i("OUTPUT", resultString.toString());
}
catch (XmlPullParserException ex) {
String msg = ex.toString();
System.out.println(msg);
}
catch (Exception e){
e.printStackTrace();
}
這就是我得到:
04-11 16:01:39.705:信息/的System.out(521):org.xmlpull.v1.XmlPullParserException:意外的類型(position:TEXT你沒有... @ 1:50 in [email protected])
我在做什麼錯?
你能提供剩餘的信息嗎?省略號內的內容很重要。另外,你可以粘貼肥皂XML? – James 2011-04-11 16:46:24
嘗試使用與本問題相關的解決方案。請訪問此鏈接。 http://stackoverflow.com/questions/8136217/passing-string-via-web-service-call-using-ksoap-generating-warnings/8150066#comment10003981_8150066 – 2011-11-24 05:22:49