ksoap2崩溃的应用程序

时间:2012-04-11 19:47:17

标签: android ksoap2 android-ksoap2

嗨我想尝试从网站上使用kso​​ap2 for android读取信息,但每当我尝试我的应用程序强制关闭。我已经从一个教程中将一个方法更改为一个站点,所以该站点应该不是问题,下面是我的代码。这是我的第一篇文章很抱歉,如果我犯了任何错误,谢谢

public class SharepointappActivity extends Activity {


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
Button gobutton = (Button)findViewById(R.id.button1);
  gobutton.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        // TODO Auto-generated method stub
        boom();
    }
});

}
public void boom(){
      final TextView text1 = (TextView)findViewById(R.id.textView1);
String NAMESPACE = "http://footballpool.dataaccess.eu";
String METHOD_NAME = "StadiumInfo";
String SOAP_ACTION = "http://footballpool.dataaccess.eu/data/";
String URL = "http://footballpool.dataaccess.eu/data/info.wso?WSDL";

SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);




Request.addProperty("sStadiumName", "Free State Stadium"); 



SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(Request);

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

try
{
   androidHttpTransport.call(SOAP_ACTION, envelope);
   SoapObject response = (SoapObject)envelope.getResponse();
 int result =  Integer.parseInt(response.getProperty(0).toString());
//    Object result2 = envelope.getResponse();
 text1.setText(result);
}
  catch(Exception e)
 {
     e.printStackTrace();
 }
  }
}

1 个答案:

答案 0 :(得分:0)

您需要在SOAP_ACTION中添加“”。

String.format( "\"http://yournamespace/%s\"", method );
相关问题