在Android蚀Web服务 [英] webservices on android eclipse
问题描述
我是新到Android /月食(JAVA),其实这个论坛了。
i am new to android/eclipse(java),in fact this forum too.
有没有人遇到这种情况呢?
Has any one met this situation?
获取用户的输入,并通过Android的使用Web服务显示相应的结果/ eclipse.is有任何可用的例子吗?
Get input from the user and display the appropriate result by consuming web service from android/eclipse.is there any examples available?
非常感谢你。
推荐答案
我张贴的教程链接
下面基本的Android教程来访问Web服务的Android 基本KSOAP安卓教程
Here basic android tutorial to access web service in android basic ksoap android tutorial
和用于创建Web服务在Java中使用本教程如何根据创建Java Web服务
and for creating webservice in java use this Tutorial How to create java based web service
用java,然后使用KSOAP库,你会得到响应编写Web服务。然后根据您的要求格式化响应。 code,以供参考:
Write a web service using java and Then by using ksoap library you will get response. Then Format that response according to your requirement. code for reference:
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL ="http://localhost/Web_Service.asmx?";// replace it by your Webservice URL
private static final String METHOD_NAME = "Function_Name";
private static final String SOAP_ACTION = "Soap Action";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("parm_name",prm_value);// Parameter for Method
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);//call the eb service Method
}
catch (Exception e)
{
e.printStackTrace();
}//Next task is to get Response and format that response
SoapObject response;
response= (SoapObject) envelope.bodyIn;
这篇关于在Android蚀Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!