我想建立莲花笔记在android上留下应用程序。为此,我需要一些Lotus脚本文件,它们将为我提供在我的应用程序中显示的数据。但首先我需要的是获取服务器登录 但在尝试登录后,我没有得到适当的回应。我需要建议如何继续为ibm lotus notes构建app leave应用程序。
protected static void tryLogin()
{ ``
HttpURLConnection connection;
OutputStreamWriter request = null;
URL url = null;
String response = null;
String parameters = "username="+"ABCD"+"password="+"!!!!!!!!";
try
{
url = new URL("http://10.194.5.33/dvlp/wdcidmanage.nsf/hwlsp?wsdl");
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
// connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestMethod("POST");
request = new OutputStreamWriter(connection.getOutputStream());
request.write(parameters);
request.flush();
request.close();
String line = "";
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null)
{
sb.append(line + "\n");
}
// Response from server after login process will be stored in response variable.
response = sb.toString();
System.out.println("response--------------------------"+response);
// You can perform UI operations here
// Toast.makeText(this,"Message from Server: \n"+ response, 0).show();
isr.close();
reader.close();
}
catch(IOException e)
{
// Error
System.out.println("error"+"----------------error is there------------");
}
}
这是我登录的代码段。在服务器端我需要做什么登录?
答案 0 :(得分:0)
如果我理解,您需要使用Domino WS:http://xx.xxx.x.xx/dvlp/wdcidmanage.nsf/hwlsp?wsdl
请Domino管理员在wdcidmanage.nsf的ACL中添加Anonymous
在androide中使用WS:http://www.c-sharpcorner.com/UploadFile/88b6e5/how-to-call-web-service-in-android-using-soap/
答案 1 :(得分:0)
有关Domino Web服务器身份验证的概述,请参阅this article。我在编写本文时考虑了Domino REST服务,但其中很多也适用于基于SOAP的服务。这是因为身份验证通常在REST和SOAP共有的层中完成。
您可能希望从基本身份验证开始。这意味着发送每个Web服务请求的Authorization标头。 Authorization标头的值只是base64编码的用户名和密码,如this Wikipedia article中所述。
在您的评论中,您说,"当我尝试与它建立连接时,它会返回一个html页面。"这听起来像服务器设置为会话身份验证。正如第一篇文章所述,您可以设置网站规则来覆盖Web服务的会话身份验证。然后,当请求未经过适当的身份验证时,您将收到HTTP 401响应。