我正在尝试使用EWS 2.0 Java api([ews-java-api] [1])连接到本地交换服务器(2007 SP1)。
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.setTraceEnabled(true);
service.setTraceFlags(EnumSet.allOf(TraceFlags.class));
service.setTraceListener(new ITraceListener() {
public void trace(String traceType, String traceMessage) {
System.out.println("Type:" + traceType + " Message:" + traceMessage);
}
});
service.setCredentials(new WebCredentials("user", "password"));
service.autodiscoverUrl("username@resmed.com.au", new RedirectionUrlCallback() );
然而,自动发现失败了。使用托管API在.Net中编写的类似代码正在运行。跟踪信息如下所示。
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:43Z">
Trying to call Autodiscover for username@resmed.com.au on https://resmed.com.au/autodiscover/autodiscover.xml.
</Trace>
Type:AutodiscoverRequestHttpHeaders Message:<Trace Tag="AutodiscoverRequestHttpHeaders" Tid="1" Time="2016-02-19 14:00:43Z">
POST /autodiscover/autodiscover.xml HTTP/1.1
Content-type : text/xml; charset=utf-8
Keep-Alive : 300
User-Agent : ExchangeServicesClient/0.0.0.0
Connection : Keep-Alive
Accept : text/xml
</Trace>
Type:AutodiscoverRequest Message:<Trace Tag="AutodiscoverRequest" Tid="1" Time="2016-02-19 14:00:44Z">
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>username@resmed.com.au</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:44Z">
null failed: I/O error: Host name 'resmed.com.au' does not match the certificate subject provided by the peer (CN=connect.resmed.com, OU=Information Technology, O=ResMed Inc., L=Bella Vista, ST=NSW, C=AU)
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:44Z">
Trying to call Autodiscover for username@resmed.com.au on https://autodiscover.resmed.com.au/autodiscover/autodiscover.xml.
</Trace>
Type:AutodiscoverRequestHttpHeaders Message:<Trace Tag="AutodiscoverRequestHttpHeaders" Tid="1" Time="2016-02-19 14:00:44Z">
POST /autodiscover/autodiscover.xml HTTP/1.1
Content-type : text/xml; charset=utf-8
Keep-Alive : 300
User-Agent : ExchangeServicesClient/0.0.0.0
Connection : Keep-Alive
Accept : text/xml
</Trace>
Type:AutodiscoverRequest Message:<Trace Tag="AutodiscoverRequest" Tid="1" Time="2016-02-19 14:00:44Z">
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>username@resmed.com.au</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:44Z">
null failed: I/O error: autodiscover.resmed.com.au
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:44Z">
Trying to get Autodiscover redirection URL from http://autodiscover.resmed.com.au/autodiscover/autodiscover.xml.
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:44Z">
No Autodiscover redirection URL was returned.
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:44Z">
Trying to get Autodiscover host from DNS SRV record for resmed.com.au.
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:45Z">
DnsQuery returned error 'DNS name not found [response code 3]'.
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:45Z">
No appropriate SRV record was found.
</Trace>
Type:AutodiscoverConfiguration Message:<Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2016-02-19 14:00:45Z">
No matching Autodiscover DNS SRV records were found.
</Trace>
The Autodiscover service couldn't be located.