Accessing the Server using the Web Service

banner art

Methods are called by first creating an instance of the Web service. Microsoft IntelliSense support is provided on the Web service methods. To access the server, you may need to specify the URL as shown here.

CrmService service = new CrmService();
service.Url = "https://<servername[:port]>/mscrmservices/2006/crmservice.asmx";
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

The Web references to the Microsoft CRM Web services define a default value for the service's Url property. These default Url values contain the Web service addresses for the Microsoft CRM server that was used when creating the Web references. If you need to point your application at a different Microsoft CRM server at run-time you must set the CrmService.Url property to the address of the Web services on that server.

Best Practices   Store the URL of the Microsoft CRM server in the application configuration file for your custom code.

If you wish to run your code against a Microsoft CRM server on a different domain, you cannot use the default network credentials. You must define valid domain credentials for that domain that have Microsoft CRM access rights. Alternatively, you can establish a trust between the two domains.

Related Topics

Security and Impersonation

© 2007 Microsoft Corporation. All rights reserved.