user3179537
user3179537

Reputation: 23

Salesforce: UNKNOWN_EXCEPTION: Destination URL not reset

I am trying to retrieve required fields information in C# (ASP.Net MVC) but it is throwing an Exception: 'UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService' on executing 'object[] results = ...' line of code. Any help will be highly appreciated.

protected SforceService binding;
//usr.UserGuid.ToString()='a65596bd-e8d3-11e2-80fc-902b34ee1bea';
var counquery = binding.queryAll("SELECT AccountId, IsDeleted FROM Contact WHERE WDA_Record_ID__c = '" + usr.UserGuid.ToString() + "'");

//Method: queryall
/// <remarks/>
    [System.Web.Services.Protocols.SoapHeaderAttribute("LimitInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
    [System.Web.Services.Protocols.SoapHeaderAttribute("QueryOptionsValue")]
    [System.Web.Services.Protocols.SoapHeaderAttribute("SessionHeaderValue")]
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:enterprise.soap.sforce.com", ResponseNamespace="urn:enterprise.soap.sforce.com", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("result")]
    public QueryResult queryAll(string queryString) {
        object[] results = this.Invoke("queryAll", new object[] {
                    queryString});
        return ((QueryResult)(results[0]));
    }

Upvotes: 1

Views: 1981

Answers (1)

Egor
Egor

Reputation: 1660

Before you can retrieve fields from Salesforce, you must make a login() call. The call will return a sessionId and a URL that you must use for subsequent calls. You are not using that URL. Refer to https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_login_loginresult.htm

serverUrl: URL of the endpoint that will process subsequent API calls. Your client application needs to set the endpoint.

Upvotes: 2

Related Questions