Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Creating a Proxy Reference by Using Visual Studio 2005 or Visual Studio 2008

Creating a Proxy Reference by Using Visual Studio 2005 or Visual Studio 2008

Topic Last Modified: 2009-07-16

This topic describes how to create proxy classes by using Microsoft Visual Studio 2005 or Visual Studio 2008 and the Add Web Reference user interface. You can use this procedure to create the complete set of proxy classes and enumerations that you need to build a client application.

Bb408520.note(en-us,EXCHG.80).gifNote:
You can also use the Web Service Description Language tool to create the proxy classes. For more information, see Web Service Description Language Tool (Wsdl.exe).

  • Visual Studio 2005 with the Visual Web Developer and C# components and an open Visual Studio 2005 solution or Visual Studio 2008 with the Visual Web Developer and C# components and an open Visual Studio 2008 solution.
  • A computer running Microsoft Exchange Server 2007 that has the Client Access server role installed.

  1. In the Solution Explorer pane in Visual Studio 2005, right-click References, and click Add Web Reference. This opens the Add Web Reference window.

    Solution Explorer, Add Web Reference
  2. Type the URL of the .wsdl file that describes the location of the Client Access server that hosts Exchange Web Services. For example, https://myClientAccessServer.myDomain.com/EWS/Services.wsdl, where myClientAccessServer.myDomain.com is the fully qualified domain name (FQDN) of the Client Access server.

    Add Web Reference
  3. Click Go. Visual Studio 2005 will attempt to connect to the Client Access server. If a server authentication certificate is not installed on the client computer, a Security Alert will appear, and you will need to install the certificate.

    Bb408520.note(en-us,EXCHG.80).gifImportant:
    If you do not install the server authentication certificate, you will not be able to add the reference to the Add Web Reference dialog box. A default Exchange Server installation tries to secure communications by creating a self-signed certificate. These certificates are safe for internal consumption, but do require all client applications to explicitly trust them. If you do not see this dialog box, an IT administrator may have updated your workstation with a trusted signature, installed a trusted certificate on the Exchange server, or both.

    To install the server authentication certificate:

    1. Click View Certificate.
      Security Allert, View Certificate
      Bb408520.note(en-us,EXCHG.80).gifNote:
      If the Security Alert window does not have a View Certificate button, restart Visual Studio and begin the procedure to add the Web reference again. On Windows Vista, even if you are running Visual Studio 2005 as an administrator, you do not have the View Certificate option. Run an instance of Microsoft Internet Explorer as an administrator, navigate to the /ews/exchange.asmx URL, and then step through the Security Alert dialog.
    2. In the Certificate window, click Install Certificate. Follow the instructions in the Certificate Import wizard.
      Certificate Information, Install Certificate
    3. In the Security Alert window, click Yes to proceed.
    4. In the dialog box that appears, provide the credentials of a mailbox user.
  4. In the Web reference name field, type ExchangeWebServices.

  5. Click Add Reference. This creates the proxy types and members in a file called Reference.cs.

  6. In the directives section of the class code file that contains type references to Exchange Web Services, add a reference to the proxy classes. For example, for C#, use the using directive. The using directive will take the following form: using <namespace>.ExchangeWebServices, where <namespace> is the namespace of the code file. You can verify the namespace name in the Reference.cs file. This file may be hidden in Solution Explorer. To show hidden files, toggle the Show All Files button at the top of the Solution Explorer pane.

  1. In the Solution Explorer pane in Visual Studio 2008, right-click References, and click Add Service Reference. This opens the Add Service Reference dialog box.

    Solution Explorer - Add Service Reference
  2. Click Advanced. This opens the Service Reference Settings dialog box.

    Add Service Reference window in VS 2008
  3. Click Add Web Reference. This opens the Add Web Reference dialog box.

    Service Reference Settings window in VS 2008
  4. Type the URL of the .wsdl file that describes the location of the Client Access server that hosts Exchange Web Services. For example, https://myClientAccessServer.myDomain.com/EWS/Services.wsdl, where myClientAccessServer.myDomain.com is the fully qualified domain name (FQDN) of the Client Access server.

    Add Web Reference
  5. Click Go. Visual Studio 2008 will try to connect to the Client Access server. If a server authentication certificate is not installed on the client computer, a Security Alert will appear, and you will need to install the certificate.

    Bb408520.note(en-us,EXCHG.80).gifImportant:
    If you do not install the server authentication certificate, you will not be able to add the reference to the Add Web Reference dialog box. A default Exchange Server installation tries to secure communications by creating a self-signed certificate. These certificates are safe for internal consumption, but do require all client applications to explicitly trust them. If you do not see this dialog box, an IT administrator may have updated your workstation with a trusted signature, installed a trusted certificate on the Exchange server, or both.

    To install the server authentication certificate:

    1. Click View Certificate.
      Security Allert, View Certificate
      Bb408520.note(en-us,EXCHG.80).gifNote:
      If the Security Alert window does not have a View Certificate button, restart Visual Studio and begin the procedure to add the Web reference again. On Microsoft Windows Vista, even if you are running Visual Studio 2008 as an administrator, you do not have the View Certificate option. Run an instance of Microsoft Internet Explorer as an administrator, navigate to the /ews/exchange.asmx URL, and then step through the Security Alert dialog box.
    2. In the Certificate window, click Install Certificate. Follow the instructions in the Certificate Import wizard.
      Certificate Information, Install Certificate
    3. In the Security Alert window, click Yes to proceed.
    4. In the dialog box that appears, provide the credentials of a mailbox user.
  6. In the Web reference name field, type ExchangeWebServices.

  7. Click Add Reference. This creates the proxy types and members in a file called Reference.cs.

  8. In the directives section of the class code file that contains type references to Exchange Web Services, add a reference to the proxy classes. For example, for C#, use the using directive. The using directive will take the following form: using <namespace>.ExchangeWebServices, where <namespace> is the namespace of the code file. You can verify the namespace name in the Reference.cs file. This file may be hidden in Solution Explorer. To show hidden files, toggle the Show All Files button at the top of the Solution Explorer pane.

After you create the proxy reference, set up the ExchangeServiceBinding proxy class and configure X509 certificates for SSL over HTTP.

Show:
© 2015 Microsoft