Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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
EWS-如何传递自动发现的凭据-ios,cocoa_Ios_Objective C_Macos_Cocoa - Fatal编程技术网

EWS-如何传递自动发现的凭据-ios,cocoa

EWS-如何传递自动发现的凭据-ios,cocoa,ios,objective-c,macos,cocoa,Ios,Objective C,Macos,Cocoa,经过大量的搜索,我发布了这个问题 问题是 我正在使用EWS使用自动发现将联系人导入MAc应用程序 下面是我的XML请求 NSString *soapMessage = [NSString stringWithFormat: @"<Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006/\"

经过大量的搜索,我发布了这个问题

问题是

我正在使用EWS使用自动发现将联系人导入MAc应用程序

下面是我的XML请求

      NSString *soapMessage = [NSString stringWithFormat:
                         @"<Autodiscover xmlns=\"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006/\">"
                         "<Request>"
                         "<EMailAddress>%@</EMailAddress>"
                         "<AcceptableResponseSchema>"
                         "http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a"
                         "</AcceptableResponseSchema>"
                         "</Request>"
                         "</Autodiscover>",self.emailId.stringValue];
NSLog(@"%@",soapMessage);

NSURL *url = [NSURL URLWithString:@"https://<domainname>/EWS/Exchange.asmx"];
NSString*soapMessage=[NSString stringWithFormat:
@""
""
"%@"
""
"http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a"
""
""
“”,self.emailId.stringValue];
NSLog(@“%@”,soapMessage);
NSURL*url=[NSURL URLWithString:@”https:///EWS/Exchange.asmx"];
以上只是一个片段。已完整地传递了其他标题

我的问题是,当用户在C#中传递时,在何处传递用户凭据,如下所示

ExchangeServiceBinding esb=新的ExchangeServiceBinding();
esb.Credentials=newnetworkcredential(“,”,“);
我试着使用质询身份验证,也试着使用发送头授权。但是没有运气


非常感谢为实现这一点提供的任何帮助。

这一切都是关于构造对EWS的正确XML请求。就这样

用于获取要测试的邮件、联系人、日历

检查它生成的请求,将其复制到XML的头部分

它像微风一样工作


发布这篇文章是为了节省一些非窗口开发人员的时间。

这一切都是为了构造对EWS的正确XML请求。就这样

用于获取要测试的邮件、联系人、日历

检查它生成的请求,将其复制到XML的头部分

它像微风一样工作


发布此消息以节省一些非窗口开发人员的时间。

实际上,挑战身份验证对Exchange Web服务有效。EWS使用ServerTrust和NTLM身份验证。 以以下方式实现NSURLConnectionLegate方法:

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    if ( challenge.previousFailureCount > 0 )
    {
        // handle authentication error here, e.g. NSError *authError = ...;
        return;
    }

    // username and password should be stored as ivars.
    NSString *username = @"your_username";
    NSString *password = @"your_password";

    NSURLCredential *urlCredential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceForSession];

    [challenge.sender useCredential:urlCredential forAuthenticationChallenge:challenge];
}


- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
    // Should return YES for NTLM and ServerTrust methods.
    NSString *authMethod = protectionSpace.authenticationMethod;
    return ([authMethod isEqualToString:NSURLAuthenticationMethodServerTrust] ||
            [authMethod isEqualToString:NSURLAuthenticationMethodNTLM] );
}

实际上,挑战身份验证适用于Exchange Web服务。EWS使用ServerTrust和NTLM身份验证。 以以下方式实现NSURLConnectionLegate方法:

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    if ( challenge.previousFailureCount > 0 )
    {
        // handle authentication error here, e.g. NSError *authError = ...;
        return;
    }

    // username and password should be stored as ivars.
    NSString *username = @"your_username";
    NSString *password = @"your_password";

    NSURLCredential *urlCredential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceForSession];

    [challenge.sender useCredential:urlCredential forAuthenticationChallenge:challenge];
}


- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
    // Should return YES for NTLM and ServerTrust methods.
    NSString *authMethod = protectionSpace.authenticationMethod;
    return ([authMethod isEqualToString:NSURLAuthenticationMethodServerTrust] ||
            [authMethod isEqualToString:NSURLAuthenticationMethodNTLM] );
}

自动发现中存在问题,因此使用直接URL-https:///EWS/Exchange.asmx 现在,请求(使用soapAction)返回所有使用200的soapAction的wsdl。我也在使用模拟。任何人都知道可能是什么问题。我有一个wsdl用于EWS与iOS的集成。请您指导我如何前进,以及需要做些什么?自动发现中存在问题,因此使用直接URL-https:///EWS/Exchange.asmx 现在,请求(使用soapAction)返回所有使用200的soapAction的wsdl。我也在使用模拟。任何人都知道可能是什么问题。我有一个wsdl用于EWS与iOS的集成。能否请您指导我如何前进,以及需要做些什么?是否有任何示例项目或代码可用于连接新闻与自动发现和发送邮件。我正在寻找一些示例代码,以帮助meis有任何示例项目或代码可用于连接新闻与自动发现和发送邮件。我正在寻找一些示例代码来帮助我