Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何拒绝java中未经授权的tls?_Java_Node.js_Typescript_Ssl_Exchangewebservices - Fatal编程技术网

如何拒绝java中未经授权的tls?

如何拒绝java中未经授权的tls?,java,node.js,typescript,ssl,exchangewebservices,Java,Node.js,Typescript,Ssl,Exchangewebservices,我正在尝试将使用ews发送电子邮件的typescript中的工作代码转换为java。 当我运行java代码时,它会抛出未经授权的错误,而typescript代码工作正常。 错误: Caused by: microsoft.exchange.webservices.data.core.exception.http.HttpErrorException: The remote server returned an error: (401) Unauthorized microsoft.exchang

我正在尝试将使用ews发送电子邮件的typescript中的工作代码转换为java。 当我运行java代码时,它会抛出未经授权的错误,而typescript代码工作正常。 错误:

Caused by: microsoft.exchange.webservices.data.core.exception.http.HttpErrorException: The remote server returned an error: (401) Unauthorized
microsoft.exchange.webservices.data.core.exception.service.ServiceRequestException: The request failed. The request failed. The remote server returned an error: (401) Unauthorized
我之所以这样认为是因为ts代码包含以下行:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
所以问题是如何在java中实现这一行?
另外,为了使java代码正常工作,您认为我还需要添加其他内容吗?

您如何提供凭据?您是连接到本地exchange服务器还是连接到Azure?你能分享你正在使用的代码吗?WebCredentials credentials=新的WebCredentials(“用户名”,“密码”);有关代码plz,请参阅如何提供凭据?您是连接到本地exchange服务器还是连接到Azure?你能分享你正在使用的代码吗?WebCredentials credentials=新的WebCredentials(“用户名”,“密码”);有关代码plz,请参阅