0

私は1つのAndroidアプリケーションを作成しました:これらは私のコードです:

package com.retailer.client;

 import android.app.Activity;
 import android.os.Bundle;
 import org.ksoap2.SoapEnvelope;
  import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.widget.TextView;

public class RetailerActivity extends Activity {
private static final String SOAP_ACTION = "http://ws.retailer.com/customerData";
private static final String METHOD_NAME = "customerData";
private static final String NAMESPACE = "http://ws.retailer.com";
private static final String URL = "http://10.0.0.55:8085/javaws/services/RetailerWS?wsdl";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);  


    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.setOutputSoapObject(request);

    HttpTransportSE ht = new HttpTransportSE(URL);
    try {
        ht.call(SOAP_ACTION, envelope);
        SoapPrimitive response = (SoapPrimitive)envelope.getResponse();


        SoapPrimitive s = response;
        String str = s.toString();
        String resultArr[] = str.split("&");//Result string will split & store in an array

        TextView tv = new TextView(this);

        for(int i = 0; i<resultArr.length;i++){
        tv.append(resultArr[i]+"\n\n");
       }
        setContentView(tv);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
}

しかし、デバッグすると表示されました: 05-24 17:46:26.031: D/SntpClient(71): 要求時間に失敗しました: java.net.SocketException: プロトコルでサポートされていないアドレスファミリ

どのようにクリアされるか..私を導いてください。

4

1 に答える 1

0

AndroidManifest.xml にパーミッションを含めましたか?

<uses-permission android:name="android.permission.INTERNET" />
于 2012-06-13T09:58:27.877 に答える