function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Peter KempPeter Kemp 

SOAP and wsdl problems

I have inherited a Salesforce C# project which was using an old wsdl written in 2005, and SOAP v7.0

In my attempt to bring it up to date I have used the new wsdl (SOAP v14.0) and rebuilt the references.cs output by wsdl.exe  However, I can't get past the following error:
Code:
public QueryResult query(string queryString)
{
object[] results = this.Invoke("query", new object[] {
queryString});
return ((QueryResult)(results[0]));
}

It says: System.Web.Services.Protocols.SoapException: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from
login must be set in the SforceService


The system logs in correctly but it doesn't seem to get past this line. I've looked through the traces and everything seems in order. I'm really not quite sure what it is asking...

Help!

SuperfellSuperfell
After login you need to change the URL property of the client stub to the serverUrl returned in the login process. See the quickstart in the API docs.
Peter KempPeter Kemp
Thanks for the superfast response! I think the code is already doing this by:
Code:
public static sforce.SforceService doLogin() 
{
 sforce.SforceService binding = new sforce.SforceService();
 try
 {
  sforce.LoginResult lr = binding.login(sforceUsername, sforcePassword);
  binding.SessionHeaderValue = new sforce.SessionHeader();
  binding.SessionHeaderValue.sessionId = lr.sessionId;
  binding.Url = lr.serverUrl;
 }
 catch (Exception)
 {}
 return binding;
}
Am I missing it somewhere else?
 



Message Edited by Peter Kemp on 11-25-2008 08:18 AM
SuperfellSuperfell
i would guess you're not using this binding somewhere.
Peter KempPeter Kemp
Hi Simon,

Was tracing the binding values and there was a problem with the login details that didn't bring up an error, but failed to reset the URL to the returned value.

Thanks!

Pete
SuperfellSuperfell
well, catching Exception and then ignoring it, it a pretty terrible thing to do, and will certainly hide any errors that the login call might return.
TraceyTracey

I'm having the same error but I can't find anything wrong with my code

 

20090327085203,Main | System.Web.Services.Protocols.SoapException: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

 

 

 

 private bool login()

{

binding = new STFtpDataSync.wsST.SforceService();

binding.Timeout = 60000;

Debug.WriteLine("Logging in now...."); Console.WriteLine("Logging in now....");

 

try

{

String SFUserName = Properties.Settings.Default.SFUserName; String SFPassword = Properties.Settings.Default.SFPassword;

loginResult = binding.login(SFUserName, SFPassword);

Console.WriteLine("Logging in successfull");

}

catch (Exception ex)

{

Debug.Write(ex.Message + ", please try again.\n\nHit return to continue...");

LogError(ex.ToString());

Console.WriteLine("Logging in error : " + ex.ToString());

return false;

}

Debug.WriteLine("\nThe session id is: " + loginResult.sessionId); Debug.WriteLine("\nThe new server url is: " + loginResult.serverUrl);

binding.Url = loginResult.serverUrl;

binding.SessionHeaderValue = new STFtpDataSync.wsST.SessionHeader();

binding.SessionHeaderValue.sessionId = loginResult.sessionId;

STFtpDataSync.wsST.GetUserInfoResult userInfo = loginResult.userInfo;

return true;

}

SuperfellSuperfell
Which line gives the error ?
TraceyTracey
Actually I don't know. It works on my machine but itmy client gets this error on his server
SuperfellSuperfell
You'll need the rest of the stacktrace.
TraceyTracey

Here this the full stacktrace

 

20090327085203,Main | System.Web.Services.Protocols.SoapException: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

   at STFtpDataSync.wsST.SforceService.query(String queryString)

   at STFtpDataSync.SF.CreateUserLookupTable()

   at STFtpDataSync.SF.LoadLookupTables()

   at STFtpDataSync.Program.Main(String[] args)

SuperfellSuperfell
seems likely that you're overwriting the binding instance variable somewhere in the rest of your code.