Archive for November, 2010

C# ASP.NET Access to Salesforce Web Service

The traditional approach to accessing a web service in Salesforce is via the webs services API. There is another way, albeit unauthenticated.

1. In Salesforce, build your web methods in a Global Class
2. In Develop –> Apex classes, find the new class and generate the WSDL
3. Create new Windows .NET App and add a button. In the code behind make it so:

private void button1_Click(object sender, EventArgs e)


string txtReturnWS;

System.Net.ServicePointManager.Expect100Continue = false;

WebReference1.HelloWorldService objProxy = new WebReference1.HelloWorldService();

objProxy.Url =”;



txtReturnWS = objProxy.GetMessage();

textBox1.Text = txtReturnWS;


catch (Exception ex)


string message = ex.Message;



Categories: C# Code Comments