我將如何完成Salesforce.com用於使用WCF登錄的功能?我想有一個身份驗證服務,返回一個正確的登錄標記。然後,每組服務調用都會將令牌傳回。我不想在每個方法調用上傳遞令牌。WCF模擬Salesforce.com登錄服務
引發我的是會話頭是如何綁定的一部分。
我也在尋找爲什麼這是或不是一個好主意。我認爲它很乾淨簡單。
謝謝!
// Create service object
binding = new SforceService();
// Invoke the login call and save results in LoginResult
LoginResult lr = binding.login("username","password");
if (!lr.passwordExpired) {
// Reset the SOAP endpoint to the returned server URL
binding.Url = lr.serverUrl;
// Create a new session header object
// Add the session ID returned from the login
binding.SessionHeaderValue = new SessionHeader();
binding.SessionHeaderValue.sessionId = lr.sessionId;
GetUserInfoResult userInfo = lr.userInfo;
} else {
Console.WriteLine("Your password is expired.");
}
這聽起來像你正在尋找添加一個自定義的SOAP標頭......我已經使用System.Web.Services.WebService在.NET中完成了這項工作,如果沒有辦法做到這一點,會感到震驚在WCF中。這個問題看起來相似,並有一個公認的迴應:http://stackoverflow.com/questions/321764/wcf-and-custom-soap-authentication – dana 2010-06-12 04:16:49