Android 如何使用RESTWeb服务
通常,我使用soapweb服务。现在我想使用RESTWeb服务。我试过了,但无法理解。在这里,我为登录提供了soapweb服务 我怎样才能写下来休息呢 这意味着任何人都可以提供示例rest服务。清楚吗?如果你需要更多信息,请告诉我 代码:Android 如何使用RESTWeb服务,android,rest,Android,Rest,通常,我使用soapweb服务。现在我想使用RESTWeb服务。我试过了,但无法理解。在这里,我为登录提供了soapweb服务 我怎样才能写下来休息呢 这意味着任何人都可以提供示例rest服务。清楚吗?如果你需要更多信息,请告诉我 代码: public String AuthenticateUser() throws SoapFault { String data = ""; String serviceUrl = DH_Constant.RB_Webservic
public String AuthenticateUser() throws SoapFault
{
String data = "";
String serviceUrl = DH_Constant.RB_Webservice_URL;
String serviceNamespace = DH_Constant.RB_Webservice_Namespace;
String soapAction = "https://www.dicomhub.com/AuthenticateUser";
String type_of_soap = "AuthenticateUser";
try
{
SoapObject Request = new SoapObject(serviceNamespace, type_of_soap);
Request.addProperty("strUserName", DH_Constant.strLoginUserName);
Request.addProperty("strPassword", strPassword);
System.out.println("AuthenticateUser Request:"+Request.toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(Request);
try
{
HttpTransportSE androidHttpTransport = new HttpTransportSE(serviceUrl);
androidHttpTransport.call(soapAction, envelope);
}
catch(Exception e)
{
System.out.println("Webservice calling error ->"+e.toString());
}
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
data = response.toString();
System.out.println("AuthenticateUser:"+response.toString());
}
catch(Exception e)
{
System.out.println("Soap Method Error ->"+e.toString());
}
return data;
}