ログイン認証のために Android アプリから WCF Web サービスに接続する必要があります。そのために、プロジェクトに ksoap2-android-assembly-2.4-jar-with-dependencies.jarを追加しました。以下は私のコードです。
String emailtxt = null, password;
emailtxt = email.getText().toString().trim();
password = pwd.getText().toString().trim();
Log.d("email", emailtxt);
Log.d("password", password);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
/*request.addProperty("arg0", emailtxt);
request.addProperty("arg1", password);*/
PropertyInfo pi = new PropertyInfo();
pi.setName("UserName");
pi.setValue(emailtxt);
pi.setType(String.class);
request.addProperty(pi);
PropertyInfo pi2 = new PropertyInfo();
pi2.setName("Password");
pi2.setValue(password);
pi2.setType(String.class);
request.addProperty(pi2);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
httpTransport.debug = true;
SoapObject result = null;
try {
httpTransport.call(SOAP_ACTION, envelope);
result = (SoapObject) envelope.getResponse();
} catch (Exception e) {
e.printStackTrace();
}
if (result == null)
Log.d("if resp null", result + "");
else {
// anything below this line relates to the service return type, may
// not apply to you
boolean success = Boolean.valueOf(result.getProperty("success")
.toString());
Log.d("login resp...not null", success + "");
}
しかし、logcat で XMLPullParserException を取得しています。修正方法を教えてもらえますか? 助けてくれてありがとう。