Visual Studio 2008 cannot create Web Reference


Why doesn't the Web Reference work in Visual Studio 2008?


Microsoft changed how Web Reference in Visual Studio 2008, in favor of their WPF services for WPF and Silverlight. Web projects seem to work correctly in VS 2008 Web Express Edition, but other project types do not.

To correct this, right click on References and choose Add Service Reference. In the next window, click on the Advanced button in the lower left. In the next window, click Add Web Reference in the lower left. Enter a name, then you can use the WSDL URL.

In your code, include:

using namespace.webreference;    (e.g. using WhatCountsDemo.WhatCountsAPI;)

Then create a new variable and set the Url, where [siteURL] is the domain of your email platform.

WhatCountsAPIService api = new WhatCountsAPIService(); api.Url = "http://[siteURL]/webservices/WhatCountsAPI"; api.getVersion();

Below is a quick C# Windows Forms code example:

using System; using System.Windows.Forms; using WhatCountsAPIDemo.WhatCountsAPI; namespace WhatCountsAPIDemo {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();             WhatCountsAPIService api = new WhatCountsAPIService();             api.Url = "http://[siteURL]/webservices/WhatCountsAPI";             string version = api.getVersion();             MessageBox.Show(version);         }     } }

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk