Posts

Showing posts with the label WCF

Consume Salesforce Rest API/Services

Image
Consume Salesforce REST services In this post, I am going to use the webrequest class to make the REST calls. Oaurth2 authentication is being used at salesforce side to validate the request. So my first request, will get the token from salesforce and the second request will get the actual data from salesforce. Let’s get started Step 1 - Create a new console application in visual studio 2013 Step 2 - Add below namespaces to your class using System.IO; using System.Runtime.Serialization.Json; using System.Net; Step 3 - The new version of salesforce using TSL 1.2, for that i have to set the correct security protocol System.Net. ServicePointManager .SecurityProtocol = ( SecurityProtocolType )3072; Step 4 – Create request to get the token. We are setting the proxy in this request as we use the proxy settings to get the internet connectivity on production servers. WebRequest loginReq = System.Net. WebRequest .Create(“Add salesforce login url”); W...

Create, Deploy and Consume WCF Rest Service

Image
If you are planning to build, deploy and consume a WCF REST service, below steps will help you in doing that. In this post I am going to use visual studio 2013 and Framework 4.0. Let’s get started Step 1 – Create a new WCF Service Step 2 – Define data contract You can define the data contract inside the project or you can write them in a separate class library. In this post I am going to add them in service project. Class Name - UserDetails.cs     [ DataContract ] public   class   UserDetails {     [ DataMember ]      public   int  UserSeq {  get ;  set ; }     [ DataMember ]      public   string  UserId {  get ;  set ; }     [ DataMember (IsRequired =  true )]      public   bool  IsValidUser {  get ;...