我开发了一个安卓应用程序
这是我的代码:
public class RetailerActivity extends Activity {
private static final String SOAP_ACTION = "http://ws.testprops.com/customerData";
private static final String METHOD_NAME = "customerData";
private static final String NAMESPACE = "http://ws.testprops.com";
private static final String URL = "http://87.76.29.180:8080/TestPrompts/services/Fetch?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();
}
}
}
这是我的本地 tomcat apache 服务器 wsdl 文件:
http://localhost:8089/TestPrompts/services/Fetch?wsdl
意味着它已成功用于我的模拟器和 android 设备。
只有我导出并创建了war文件并上传到我的tomcat服务器中的同一个TestPrompts项目。
这是我的 tomcat 服务器 wsdl 文件:
http://87.76.29.180:8080/TestPrompts/services/Fetch?wsdl
但这里只面临问题:
我必须把这些 URL 表示在模拟器和 android 设备上都没有得到任何结果。只是得到黑屏。
控制台窗口显示以下错误:
11-19 15:12:55.232: D/SntpClient(73): request time failed: java.net.SocketException: Address family not supported by protocol
请帮助我。我该如何解决我的错误。