通常、私は Soap Web サービスを使用しました。今、残りの Web サービスを使用したいと考えています。してみましたが、理解できません。ここでは、ログイン用の SOAP Web サービスを提供しました。
Restのためにどのように書くことができますか?
誰でもサンプルレストサービスを提供できるということです。それは明らかですか?さらに情報が必要な場合は、お知らせください。
コード :
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;
}