Monday, February 2, 2009

GenerateAuthenticationHeader

The GenerateAuthenticationHeader function retrieves a properly formed Microsoft Dynamics CRM authentication header. This authentication header automatically determines the appropriate authentication type to use for each deployment type: on-premise, IFD, or Microsoft Dynamics CRM Online. Note that the SOAP header for IFD does not include information about the CrmTicket because a session-based ticketing system is used. For more information, see Authentication.

Each XMLHttp request requires a <soap:Header>
Example
You can generate this header for your code by using the following function:
GenerateAuthenticationHeader();
Without this function you would need to define a SOAP header in your code like the one here for the on-premise version:

<soap:Header>
<CrmAuthenticationToken xmlns="http://schemas.microsoft.com/crm/2007/WebServices">
<AuthenticationType xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">
0
</AuthenticationType>
<OrganizationName xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">
AdventureWorksCycle
</OrganizationName>
<CallerId xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">
00000000-0000-0000-0000-000000000000
</CallerId>
</CrmAuthenticationToken>
</soap:Header>

1 comment:

naren said...

This GenerateAuthenticationHeader() function only works from Crm 4.0 Version. Dont try it with the previous versions. Thanks