我正在使用这个实验性 api https://github.com/mtorak/java-lync-client连接到我们的 lync 2013 服务器。
但是它根本不起作用。我可以将包部署到 jboss 7.1.1 调用 web 服务,但答案是否定的。日志显示以下内容:
12:03:23,927 INFO [stdout] (http-localhost-127.0.0.1-8080-1) REQUEST 1:https://lyncdiscover.example.com/Autodiscover/AutodiscoverService.svc/root?originalDomain=example.com
12:03:23,931 INFO [stdout] (http-localhost-127.0.0.1-8080-1) -------------------------------
12:03:23,933 INFO [stdout] (http-localhost-127.0.0.1-8080-1) ----Request Headers----
12:03:23,935 INFO [stdout] (http-localhost-127.0.0.1-8080-1) [Lorg.apache.http.Header;@123fb1a8
12:03:26,367 INFO [stdout] (http-localhost-127.0.0.1-8080-1) HTTP/1.1 403 Forbidden ( The server denied the specified Uniform Resource Locator (URL). Contact the server administrator. )
12:03:26,444 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
12:03:26,446 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at [Source: java.io.StringReader@1e196a60; line: 1, column: 2]
12:03:26,448 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
12:03:26,449 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
12:03:26,451 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
12:03:26,454 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198)
12:03:26,455 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485)
12:03:26,457 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770)
12:03:26,459 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
12:03:26,461 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.codehaus.jackson.map.ObjectMapper.readTree(ObjectMapper.java:1542)
12:03:26,462 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.comverse.lync.LyncClient.authenticate(LyncClient.java:537)
12:03:26,464 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.comverse.lync.LyncClient.createApplication(LyncClient.java:620)
12:03:26,465 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.comverse.lync.servlet.LyncGatewayServlet.queryPresence(LyncGatewayServlet.java:107)
12:03:26,467 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at com.comverse.lync.servlet.LyncGatewayServlet.doGet(LyncGatewayServlet.java:59)
12:03:26,469 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
12:03:26,471 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
12:03:26,472 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
12:03:26,475 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
12:03:26,478 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
12:03:26,481 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
12:03:26,483 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
12:03:26,486 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
12:03:26,488 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
12:03:26,490 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
12:03:26,493 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
12:03:26,495 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
12:03:26,497 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
12:03:26,499 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
12:03:26,501 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) at java.lang.Thread.run(Thread.java:744)
我查看了代码,我知道它失败的地方,这才是真正的开始。
在 authenticate() 方法中有以下调用。
LyncHttpOperationWrapper httpOpWrapper1 = doFirstRequest();
if (httpOpWrapper1 != null) {
JsonNode node;
try {
node = mapper.readTree(httpOpWrapper1.getResponseBody());
似乎 doFirstRequest() 正在执行获取,但服务器拒绝了它。
我试图在 Firefox 中访问相同的 url,我得到了答案,我没有被拒绝。
<resource rel="root" href="https://abs.example.com/Autodiscover/AutodiscoverService.svc/root?originalDomain=example.com">
<link rel="user" href="https://abs.example.com/Autodiscover/AutodiscoverService.svc/root/oauth/user?originalDomain=example.com"/>
<link rel="xframe" href="https://abs.example.com/Autodiscover/XFrame/XFrame.html"/>
客户端设置如下:
private static final String LYNC_DISCOVERY_URL_KEY = "lyncDiscoveryUrl";
private static final String LYNC_DISCOVERY_URL_VALUE = "https://abs.example.com/Autodiscover/AutodiscoverService.svc/root?originalDomain=example.com";
private static final String RESPONSE1_LINKS_SELF_HREF = "_links-self-href";
private static final String RESPONSE1_LINKS_USER_HREF = "_links-user-href";
private static final String RESPONSE1_LINKS_XFRAME_HREF = "_links-xframe-href";
private static final String RESPONSE_HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
private static final String RESPONSE_HEADER_VALUE_MSRTCOAUTH = "MsRtcOAuth";
private static final String RESPONSE_HEADER_VALUE_BEARER = "Bearer";
private static final String LYNC_EXT_POOL_HOST = "lyncextpool.example.com";
private static final String LYNC_EXT_POOL_URL = "https://lyncextpool.example.com";
private static final String X_MS_ORIGIN_HEADER_VALUE = "http://192.168.0.10";
private static final String X_MS_ORIGIN_HEADER_KEY = "X-Ms-Origin";
private static final String PROTOCOL_HTTPS = "https";
private static final String SSL_CONTEXT = "SSL";
private static final int SSL_PORT = 443;
如何使用 java 从 linux 连接到 Lync 2013?
非常感谢您提前提供的帮助。