-
-
Save anonymous/7d533cf2b4822fb29317 to your computer and use it in GitHub Desktop.
Salesforce .NET Developer Environment - Verify WSDL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.ServiceModel; | |
using VerifyWSDLTest.sforce; | |
namespace VerifyWSDLTest | |
{ | |
class Program | |
{ | |
private static SoapClient client; | |
private static LoginResult loginResult; | |
private static bool login() | |
{ | |
client = new SoapClient(); | |
string acctName = "YOUR DEVORG USERNAME"; | |
string acctPw = "YOUR DEVORG PASSWORD AND SECURITY TOKEN"; | |
try | |
{ | |
loginResult = client.login(null, acctName, acctPw); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("Unexpected login error: " + e.Message); | |
Console.WriteLine(e.StackTrace); | |
return false; | |
} | |
return true; // success | |
} | |
static void Main(string[] args) | |
{ | |
if (login()) | |
{ | |
// display some current login settings | |
Console.Write("Service endpoint: " + loginResult.serverUrl + "\n"); | |
Console.Write("Username: " + loginResult.userInfo.userName + "\n"); | |
Console.Write("SessionId: " + loginResult.sessionId + "\n"); | |
Console.Write("Press any key to continue:\n"); | |
Console.ReadKey(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, i'm trying this in VS 2019 and it's not working the reference to "using VerifyWSDLTest.sforce;" and the method "loginResult = client.login(null, acctName, acctPw);"