2011-09-13 51 views
0
public class main extends Activity { 

    /** Called when the activity is first created. */ 
    private static String SOAP_ACTION = "http://footballpool.dataaccess.eu/data/TopGoalScorers"; 
    private static String NAMESPACE = "http://footballpool.dataaccess.eu"; 
    private static String METHOD_NAME = "TopGoalScorers"; 
    private static String URL = "http://footballpool.dataaccess.eu/data/info.wso?WSDL"; 

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
    request.addProperty("iTopN", 5); 

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
      SoapEnvelope.VER11); 
    envelope.setOutputSoapObject(request); 

    // Make the soap call. 
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); 
    //AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport("http://www.google.co.in"); 

    try { 
     // this is the actual part that will call the webservice 
     androidHttpTransport. call(SOAP_ACTION, envelope); 
    } catch (Exception e) { 
     e.printStackTrace(); 
     Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show(); 
    } 
    // Get the SoapResult from the envelope body. 
    SoapObject result = (SoapObject) envelope.bodyIn; 
    } 
} 
+1

你把互联网的权限放在清单中 – ingsaurabh

+1

在清单中添加权限作为“<使用权限android:name =”android.permission.INTERNET“/>” –

+0

ya已经放弃了权限.. – SilentKiller

回答

5

您是否已将INTERNET权限添加到您的清单文件?

+0

ya我已经完成那.. – SilentKiller

+0

检查你的系统日期和时间,是否正确?有时它也会产生问题 –

+0

是的,我已经检查过,也是.. – SilentKiller