我正在尝试从我的 Java 应用程序(FileNet P8 中的事件操作处理程序)访问 Content Navigator 上的 PluginService。应用程序使用 JAXRS 登录服务security_token从 Content Navigator 服务器接收。但是,如果我尝试调用 PluginService,我会收到登录已过期的响应。
我能够获得安全令牌,如此代码块中所述:
URL logonUrl = new URL("http://icn-host:9081/jaxrs/logon"
+ "?userid=user"
+ "&password=password"
+ "&desktop=admin"
+ "&contextPath=%2Fnavigator");
HttpURLConnection logonConnection = (HttpURLConnection)logonUrl.openConnection();
logonConnection.setRequestMethod("POST");
logonConnection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
logonConnection.setDoOutput(true);
InputStream logonResponse = logonConnection.getInputStream();
String responseText = IOUtils.toString(logonResponse, "UTF-8")
.replaceFirst("^\\{}&&", "");
JSONObject responseJson = JSONObject.parse(responseText);
return (String)responseJson.get("security_token");
Run Code Online (Sandbox Code Playgroud)
但是当我尝试发出另一个请求时,我收到错误响应:
URL requestUrl = new URL("http://icn-host:9081/plugin.do"
+ "?plugin=myPlugin&action=myPluginService&myRequestProps=foobar");
HttpURLConnection requestConnection =
(HttpURLConnection)requestUrl.openConnection();
requestConnection.setRequestMethod("GET");
String securityToken = getSecurityToken(); // calls above code
requestConnection.setRequestProperty("security_token", securityToken);
equestConnection.setDoOutput(true); …Run Code Online (Sandbox Code Playgroud) 我System.Net.Mail.SmtpClient在 Powershell 中使用 .Net 类来发送带有一些附加文档的邮件。它在我们的测试环境中运行良好,但在生产中失败。
问题是,在生产中需要一个完全指定的域名来发送邮件。但是,据我所知, SmtpClient 不允许我指定这一点。我在网上看过,你可以在asp.net 中使用web.config 设置来指定域名,但我似乎无法在Powershell 中使用它。
有没有办法解决这个问题,或者我必须用另一种语言来实现它?
编辑:这是我正在使用的代码
$SmtpClient = New-Object System.Net.Mail.SmtpClient "mail.mailserver.com", 25
$Mail = New-Object System.Net.Mail.MailMessage
# Custom (working) Cmdlet for creating a NetworkCredential object
$SmtpClient.Credentials = (GetCredential-FromFile)
$Mail.Subject = "New Import"
$Mail.Body = ""
$Mail.From = "myaddress@mailserver.com"
$Mail.To.Add("myaddress@mailserver.com")
$Mail.Attachments.Add(New-Object System.Net.Mail.Attachment "file.txt")
$SmtpClient.Send($Mail)
Run Code Online (Sandbox Code Playgroud)
SMTP-Server 已设置,但我需要设置客户端(使用脚本的机器)的 FQDN。