Himanshu Jain
Himanshu Jain

Reputation: 518

Information regarding salesforce

I am developing an application in ASP.NET and in that I need to integrate sales force CRM using APEX. Like I have reach a bit over that, I need to write the APEX code on salesforce devlopers area and need to call tha functions and classes from my ASP.NET application, buti am not sure that i am following the right way. So can any one please help me how can I integrate APEX (Salesforce) in to my ASP.NET C# application. Thanks in advance.

Upvotes: 0

Views: 286

Answers (1)

Daniel Ballinger
Daniel Ballinger

Reputation: 13537

Doing things "the right way" is highly subjective and will vary greatly depending on your specific requirements.

Generally speaking, if you want to invoke Apex from .NET there are two ways to do so:

  1. Expose a static Apex method as a web service. This is as easy as making the Apex class global, adding the webService keyword to the static method, and then finally generating the WSDL in Salesforce that can be imported into .NET. See WebService Methods.
  2. If you aren't interested in getting any data back you could also run anonymous Apex via the Apex API. This is less commonly used, so you would be better sticking with a SOAP or REST web service.

See also Invoking Apex

When you import the apex webservice WSDL into your .NET project you will get a service class generated. Create an instance of this and then create a SessionHeader for it's SessionHeaderValue. This SessionHeader will require the ServerURL and SessionId to be set. Assign your access token to the SessionId here. Then you should be free to call your web service. See Calling a custom Salesforce Apex web service from C#

Upvotes: 1

Related Questions