1

こんにちは、Android 用の ksoap2 を使用して Web サイトから情報を読み取ろうとしていますが、アプリを強制終了しようとすると、いつでも終了します。サイトをメソッドからチュートリアルのサイトに変更したので、サイトは問題にならないはずです。以下は私が持っているコードです。初めての投稿なので間違っていたらすみませんよろしくお願いします

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();
 }
  }
}
4

1 に答える 1

0

SOAP_ACTION に "" を追加する必要があります。

String.format( "\"http://yournamespace/%s\"", method );
于 2012-05-29T20:22:59.110 に答える