none
CRM2011 webservice 调用问题,求救!! RRS feed

  • 问题

  • 我用调用CRM2011 webservice 引用“http://10.0.0.5:5555/MSCRMServices/2007/CrmServiceWsdl.aspx”时,执行了下列的代码,出现了

    【HTTP 请求未经客户端身份验证方案“Anonymous”授权。从服务器收到的身份验证标头为“Negotiate,NTLM”】的错误 ,求救怎么解决T_T

    //认证凭证
    CRM.CrmAuthenticationToken toKen = new CRM.CrmAuthenticationToken();
    //我的组织
    toKen.OrganizationName = "Test";
    //建立一个CrmService对像
    CRM.CrmServiceSoapClient crmService = new CRM.CrmServiceSoapClient();
    CRM.WhoAmIRequest userRequest = new CRM.WhoAmIRequest();
    CRM.CallerOriginToken originToken=new CRM.CallerOriginToken();
    CRM.CorrelationToken correlationToken =new CRM.CorrelationToken();
    CRM.WhoAmIResponse user = (CRM.WhoAmIResponse)crmService.Execute(toKen, originToken, correlationToken, userRequest);
    

     

    2011年8月16日 7:22

全部回复

  • 引用“http://10.0.0.5:5555/MSCRMServices/2007/CrmServiceWsdl.aspx”时

    这个是4.0的 webservice,正确写法应该是:

            CrmAuthenticationToken token = new CrmAuthenticationToken();
            token.AuthenticationType = AuthenticationType.AD;
            token.OrganizationName = "Test";

            CrmService crmService = new CrmService();
            crmService.Url = "you webservice url";
            crmService.CrmAuthenticationTokenValue = token;
            crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;

            WhoAmIRequest whoRequest = new WhoAmIRequest();
            WhoAmIResponse whoResponse = (WhoAmIResponse)crmService.Execute(whoRequest);

    2011提供的是wcf

    http://ServerName/OrganizationName/XRMServices/2011/Organization.svc


    微软CRM
    2011年8月17日 0:42
    版主