• SF Sandhya
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0



I am getting below exception while getting the opportunity objects from my account.

"UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService"


While login  i am setting the one url and once its done i am setting one more URL.


Before login

//if debug_mode use the following service urlif(isSalesForceDebugModeEnabled)

binding.Url =



After login


binding.Url = loginResult.serverUrl;


This is my login function.

privatestaticbool SalesForceLogin(SforceServicebinding)


LoginResult loginResult = null;


GetUserInfoResult userInfo = null;


// Time out after a minute

binding.Timeout = 60000;

// Try to log in the usertry


string username = username@uname.com;


string password = "password";

loginResult = binding.login(username, password);


catch (System.Web.Services.Protocols.SoapException)


// This is likley to be caused by bad username or password//AppError.AddError("SalesForce Login [Soap Exception]: " + e.Message, AppError.AudienceEnum.TechnicalTeam, AppError.LevelEnum.Exception);returnfalse;


catch (Exception)


// This is something else, probably comminication//AppError.AddError("SalesForce Login [Other Error]: " + e.Message, AppError.AudienceEnum.TechnicalTeam, AppError.LevelEnum.Exception);returnfalse;


//Create a new session header object and set the session id to that returned by the login

binding.SessionHeaderValue =


binding.SessionHeaderValue.sessionId = loginResult.sessionId;

userInfo = loginResult.userInfo;

//Change the binding to the new endpoint

binding.Url = loginResult.serverUrl;




While getting the opportunities it is raising the exception




QueryResult qr = null;

binding.QueryOptionsValue =


binding.QueryOptionsValue.batchSize = 250;

binding.QueryOptionsValue.batchSizeSpecified =



DescribeSObjectResult result = binding.describeSObject("Opportunity");


boolcanCreate = result.createable;


foreach(Field f inresult.fields)




qr = binding.query(

"select Name,Web_Order_Number__c,CloseDate,StageName,Tax_Amount__cSpecified,Promo_Code_Discount_Amount__cSpecified from Opportunity");


// qr = binding.query("select ID, Name, ProductCode, Description from Product2");



grdProducts.DataSource = qr.records;




 In describeresult object i am getting exception.What is the problem i could nt able to understand,

Note:I am new bie of salesforce.I dont know anything abt SF.Why they are setting 2 urls,who will give those urls,Is there any proper document .I have searched in net but full high teminology.I could nt able to understand.

Please provide me answer for above prob and Doc for SF