Generate a Service Proxy

By | August 14, 2011

In CRM 2011 you can generate a proxy of CRM’s web services so you can use any of the entities in your custom code in what is called early binding.

You need to have the SDK installed and use the tool crmsvcutil.exe which comes with it. For this example we’ll assume that the SDK has been deployed in the folder E:\CRM2011SDK. You can download the SDK here.

See this posting for information on how to obtain the URL to the Organization.svc service.

Open a command prompt window and type the following command:

E:\CRM2011SDK\sdk\bin\crmsvcutil.exe

/url:http://trgvstacrm02:5555/QualtechSoftware/XRMServices/2011/

Organization.svc

/l:CS

/out:OrganizationService.cs

/namespace:Qualtech.Crm.Proxy

/serviceContextName:OrganizationContext

Options

/nologo
Suppresses the banner.

/language:<language>
The language to use for the generated proxy code.  This can be either ‘CS’
or ‘VB’.  The default language is ‘CS’.  Short form is ‘/l:’.

/url:
A url or path to the SDK endpoint to contact for metadata.

/out:<filename>
The filename for the generated proxy code.  Short form is ‘/o:’.

/namespace:<namespace>
The namespace for the generated proxy code.  The default namespace is the
global namespace.  Short form is ‘/n:’.

/username:<username>
Username to use when connecting to the server for authentication.  Short
form is ‘/u:’.

/password:<password>
Password to use when connecting to the server for authentication.  Short
form is ‘/p:’.

/domain:<domain>
Domain to authenticate against when connecting to the server.  Short form
‘/d:’.

/serviceContextName:
The name for the generated service context. If a value is passed in, it wi
be used for the Service Context.  If not, no Service Context will be gener

/help
Show this usage message.  Short form is ‘/?’.

/deviceid:
Device ID to use when connecting to the online server for authentication.
Short form is ‘/di:’.

/devicepassword:
Device Password to use when connecting to the online server for
authentication.  Short form is ‘/dp:’.

You can download here an example of a proxy C# class generated with this tool.

Leave a Reply