0
我試着去努力的Android網絡服務,但我已經邁出了仿真器輸出錯誤:的Android KSOAP輸出錯誤
org.xmlpull.v1.XmlPullParserException:expecteed:START_TAG {HTTP:/ /schemas.xmlsoap.org/soap/envelope/}Envelope(position:[email protected]:6在[email protected])
在這裏,我的代碼:
package com.webServiceDeneme;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;
public class WebServiceDenemeActivity extends Activity {
Button btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn=(Button)findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String NAMESPACE="http://www.vakifbank.com.tr/";
String METHOD_NAME="faiz-maliyet-oranlari.aspx";
String SOAP_ACTION="http://www.vakifbank.com.tr/faiz-maliyet-oranlari.aspx";
String URL="http://192.168.2.1/VipEvents/Services/BasicServices.asmx";
SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
try
{
AndroidHttpTransport aht=new AndroidHttpTransport(URL);
aht.call(SOAP_ACTION, envelope);
SoapPrimitive res=(SoapPrimitive)envelope.getResponse();
btn.setText(res.toString());
}
catch (Exception e) {
// TODO: handle exception
btn.setText(e.toString());
e.printStackTrace();
}
}
});
}}
任何幫助表示讚賞。
我加你的代碼部分,但問題並沒有消失,有同樣的錯誤.. :( – rockenpeace
這不應該解決你的問題,它應該幫助你驗證你收到的SOAP響應,即肥皂信封;而不是一些隨機響應 – inazaruk
我看..我想我應該添加p ropertyinfo部分,因爲這個問題不是來自網站(「www.vakifbank.com.tr」可用)..非常感謝.. – rockenpeace