你在那个例子中得到了它。
您在以下位置创建了 SOAP Web 服务:
在 Google App Engine 上构建 SOAP 服务器
然后您创建了一个从 Servlet 使用它的客户端:
使用 JAX-WS 在 Google App Engine 上构建 SOAP 客户端
现在您需要从您的 Android 应用程序中使用正确的参数值对该 URL 进行 HTTP 客户端调用。
使用http://developer.android.com/reference/java/net/HttpURLConnection.html提供的示例和 url 提供了您的示例
URL url = new URL(" http://greeter-client.appspot.com/hellosoapclient?name=SOAP&arriving=true");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
readStream(in);
finally {
urlConnection.disconnect();
}
在readStream中,您可以从 GAE 托管的服务中读取响应
readStream 可以是这样的:
private static String readStream(InputStream is) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}