
Using Visual Studio 2008 with adCenter API
Using the adCenter API with Microsoft Visual Studio 2008 requires that you use the Microsoft .NET Framework version 3.0 or the .NET Framework version 3.5, and then add a service reference to your project.
Create a project that uses the adCenter API in Visual Studio 2008 by using the following steps.
-
Open Visual Studio 2008.
-
Create a new Visual C# or Visual Basic project. In the New Project combo box, make sure that .NET Framework 3.0 or .NET Framework 3.5 is selected.
-
After the project has been created, select Project, and then select the Add Service Reference command.
-
We recommend that you use message contracts when you create your client proxy, although it isn't required. Create a client proxy that uses message contracts by using the following steps:
-
In the Add Service Reference dialog box, click Advanced.
-
In the Service Reference Settings dialog box, select the Always generate message contracts check box as shown in the following figure.
Always generate message contracts check box
-
Click the OK button.
For more information about message contracts, see Message Contracts.
-
In the Address field, type the URL of the Web service to create a service reference for. For example, to create a service reference for the sandbox reporting Web service, type "https://sandboxapi.adcenter.microsoft.com/Api/Advertiser/V6/Reporting/ReportingService.svc" in the Address field.
-
Click Go. Visual Studio then contacts the given URL and downloads the necessary information.
-
Type a descriptive name for the namespace in Namespace. This can be any name you want as long as it’s unique within your project; for example, "adCenter_ReportingService".
-
Click OK. Visual Studio then creates the necessary files and adds them to your project.
-
Repeat these steps for any other service references you may need.
To use the Web service, add a using or Imports statement to your code to include the service reference. The following is what a using statement would look like for the reporting service reference that was previously created.
using <project name>.adCenter_ReportingService;
The following is what an Imports statement would look like for the reporting service reference that was previously created.
Imports <project name>.adCenter_ReportingService
Replace <project name> with the name of your project.
If you'll be adding or updating assets, you'll have to update one of the following sets of configuration values.
If your binding point is defined in your app.config file, open it and then change the following items:
-
Set the
maxArrayLength attribute of the readerQuotas element to "70000".
-
Set the
maxReceivedMessageSize attribute of the basicHttpBinding element to "1500000".
If you are manually creating your binding point, change the following items:
Changing these settings allows the SOAP messages to be large enough to handle the maximum asset sizes.
For more information about assets, see Advertising Assets.
You are now ready to begin writing code that uses the adCenter Web services you have added references to.