2012-07-25 4 views
1

CRM 웹 서비스를 실행하려고 다음과 같은 오류를 얻기 \잘못된 요청 (415)

코드

  CrmAuthenticationToken token = new CrmAuthenticationToken(); 
      token.AuthenticationType = 0; //Use AD authentication 
      token.OrganizationName = "Organization"; 
      CrmService service= new CrmService(); 
      service.CrmAuthenticationTokenValue = token; 
      service.Credentials = System.Net.CredentialCache.DefaultCredentials; 
      service.PreAuthenticate=true; 
      WhoAmIRequest whoami = new WhoAmIRequest(); 
      WhoAmIResponse whoResp = ((WhoAmIResponse)(service.Execute(whoami))); 

구성 설정 :.

<add key="CrmSdk.CrmServiceWsdl" value="http://server/organization/XRMServices/2011/Organization.svc/web"/> 

오류 :

System.Net.WebException : HTTP 상태 415로 요청이 실패했습니다. 콘텐츠 형식 'text/xml; charset = utf-8 '이 예상 유형이 아니 었습니다'application/soap + xml; charset = utf-8 '..

아래 설정 값을 변경하면 "잘못된 요청"이 표시됩니다.

구성 설정 :

<add key="CrmSdk.CrmServiceWsdl" value="http://server/organization/XRMServices/2011/Organization.svc/web"/> 

오류 :

The message with Action 'http://schemas.microsoft.com/crm/2007/WebServices/Execute' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

답변

2

당신이에서 값을 변경해야합니다, 그래서 당신은, 2007 년 엔드 포인트에 대해이 설정을 가지고 :

value="http://server/organization/XRMServices/2011/Organization.svc/web" 

to

value="http://server/org/MSCRMServices/2007/CrmService.asmx" 

2011을 사용하려는 경우 IOrganizationService를 사용해야합니다. SDK를 여기 http://www.microsoft.com/en-us/download/details.aspx?id=24004

에서 정말 좋은 예는 또 다른 예뿐만 아니라 http://nishantrana.wordpress.com/2010/11/03/sample-code-for-using-iorganizationservice-in-crm-2011/

이 것입니다