开发者

Host is Unresolved... Unknown host Exception [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.
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);
    //An开发者_JAVA技巧droidHttpTransport 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;
  }
}


Have you added INTERNET permission to your manifest file?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜