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