12-01 11:50:24.921: E/Error XmlPullParserException :(1279): Error on XmlPullParserException unexpected type (position:END_DOCUMENT null@1:1 in java.io.InputStreamReader@4126e7c8)
12-01 11:50:25.201: W/dalvikvm(1279): threadid=11: thread exiting with uncaught exception (group=0x40a13300)
Konuyu internette çok araştırmama rağmen bir sonuca ulaşamadım bilgisi olan birileri varmı acaba?
Android Kodumda...
package com.pusula.actions.contentview;
import java.io.IOException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;
import com.pusula.actions.contentview.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class LoginActivity extends Activity {
protected static final String TAG = "Login";
private static final String METHOD_NAME = "LoginAuthenticate";
private EditText txtLoginUserName;
private EditText txtLoginPassword;
String res;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
//getActionBar().setDisplayHomeAsUpEnabled(false);
txtLoginUserName = (EditText) findViewById(R.id.txtLoginUserName);
txtLoginPassword = (EditText) findViewById(R.id.txtLoginPassword);
Button loginButton = (Button) findViewById(R.id.buttonLogin);
loginButton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
//new ServiceTask().execute();
//startActivity(new Intent(LoginActivity.this,MainActivity.class));
new ServiceTask().execute();
}
});
Button exitButton = (Button) findViewById(R.id.buttonExit);
exitButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
launchAlertDiaolg();
}
});
}
private String loginService(String pKullaniciAdi, String pSifre, String pHastaneKodu)
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("pKullaniciAdi", pKullaniciAdi);
request.addProperty("pSifre", pSifre);
request.addProperty("pHastaneKodu", pHastaneKodu);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(request);
HttpTransportSE aht = new HttpTransportSE(URL);
aht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
aht.debug= true;
System.out.println("ÖNEMLİ....:" + aht.requestDump);
System.setProperty("http.keepAlive", "false");
try {
aht.call(SOAP_ACTION, soapEnvelope);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.getMessage();
Log.e("Error XmlPullParserException : ", "Error on XmlPullParserException " + e.getMessage());
}
String result = null;
try {
result = " " + (SoapPrimitive) soapEnvelope.getResponse();
Log.i("WebService output", result.toString());
// sonuc.setText(result);
res = result.toString();
} catch (SoapFault e) {
e.printStackTrace();
} catch (Exception e) {
Log.e("Error : ", "Error on soapPrimitiveData() " + e.getMessage());
e.printStackTrace();
}
return res;
}
private class ServiceTask extends AsyncTask<Void, Void, String> {
private final ProgressDialog dialog = new ProgressDialog(LoginActivity.this);
protected void onPreExecute() {
this.dialog.setMessage("Lütfen Bekleyiniz...");
this.dialog.show();
}
protected String doInBackground(Void... unused) {
String auth = loginService("admin", "uhg34C", "CAMLICA");
System.out.println(auth);
return auth;
}
protected void onPostExecute(String serviceResult) {
if (this.dialog.isShowing()) {
this.dialog.dismiss();
}
String result = serviceResult;
//sonuc.setText(result + " °F");
Toast.makeText(getApplicationContext(), "Servis Dönen Sonuç : " + result, Toast.LENGTH_LONG).show();
}
}
protected void launchAlertDiaolg() {
AlertDialog.Builder cikisDialog = new AlertDialog.Builder(this);
cikisDialog
.setMessage("Çıkmak İstediğinizden emin misiniz?")
.setTitle(R.string.app_name)
.setIcon(R.drawable.exit)
.setCancelable(false)
.setPositiveButton("Evet",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
LoginActivity.this.finish();
}
})
.setNegativeButton("Hayır",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = cikisDialog.create();
alert.show();
}
}
şeklinde arkadaşlar.
Servisim çalışıyor ve test ettiğimde başka bir projede (C#) sonuç alıyorum.