2011-08-30 74 views
0

我正在使用HttpGet方法从我的Android应用中的Web服务中检索数据。以下是我现在使用的代码。如何使用Android中的Soap连接到Web服务?

String url = URLEditor.encode("http://"+Constants.strURL+"Orders.asmx/CheckWebConnection? TechCode="+username+"&TechPIN="+password); 
    HttpClient httpClient = new DefaultHttpClient(); 
    HttpGet httpGet = new HttpGet(url); 
    response = httpClient.execute(httpGet); 
    HttpEntity entity = response.getEntity(); 
    if(entity == null) return false; 
    is = entity.getContent(); 

但是,HttpGet方法现在没有正确响应,我被要求更改方法。 Web服务不支持HttpPost。我怎样才能用肥皂做同样的操作?我是否需要下载任何库并附加到Eclipse?请帮我

回答

0

下载ksoap2。你会发现许多与它包括计算器的帮助,首先是:

How to call a .NET Webservice from Android using KSOAP2?

+0

是的,它的工作原理......我得到的数据块,而转换的响应(SoapObject)为String。如何解析? –

+0

问题是关于连接到web服务,如果我的答案可以帮助您将其标记为接受的答案。如果你想知道如何解析一个soapobject然后问另一个问题,并提供有关它的详细信息:什么样的web服务,显示数据看起来像什么等... – mthpvg