Home > C# Code Comments > C# ASP.NET Access to Salesforce Web Service

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 = http://xxx.force.com/forms/services/Soap/class/helloWorld”;

try

{

txtReturnWS = objProxy.GetMessage();

textBox1.Text = txtReturnWS;

}


catch (Exception ex)

{


string message = ex.Message;

}

}


Advertisements
Categories: C# Code Comments
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: