Reply
Regular Contributor
mandyc
Posts: 47
0
Accepted Solution

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

I'm getting the above error message and I'm assuming this has to do with my authentication code below. The .NET web service is being called from an outbound message in my sandbox environment. The .Net service references the enterprise WSDL, URL, username and password+security token from the sandbox. I also added the server address where the web service is hosted to the trusted IP page in Salesforce (although I don't think this is necessary since it's located on our network). Your advice is appreciated!

 

EnterpriseWebReference.SforceService binding = new EnterpriseWebReference.SforceService();
        EnterpriseWebReference.LoginResult loginResult = new EnterpriseWebReference.LoginResult();

        binding.Url = "https://test.salesforce.com/services/Soap/c/25.0";
        loginResult = binding.login("username", "password+token");

        binding.SessionHeaderValue = new EnterpriseWebReference.SessionHeader();
        binding.SessionHeaderValue.sessionId = loginResult.sessionId;

 

Moderator
SimonF
Posts: 7,980
0

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

You need to update the binding URLs property after calling login based on serverUrl property in the LoginResult, see the getting started guide in the soap api docs.

 

Also, OM can be configured to send you a sessionId & serverUrl, so you don't need to call login in your OM handler, you can just use the passed sessionId to make subsequent API calls.

Cheers
Simon
docs | blog | twitter
Regular Contributor
mandyc
Posts: 47
0

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

Thanks, Simon!! I am now logged in and using the passed sessionId and serverUrl from the OM.

 

In my code I create SelfServiceUser records. Although I set ssu.IsActive = true; the SelfServiceUser record generates but the IsActive column is not checked. Do you know whether there is a limitation to enabling SSU records in Salesforce via the API?

 

 

 

 

Moderator
SimonF
Posts: 7,980
0

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

you also need to set the specified flag, see the sticky post on "why is my boolean/int/date being ignored"

 ssu.IsActiveSpecified = true

Cheers
Simon
docs | blog | twitter
Regular Contributor
mandyc
Posts: 47
0

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

Thank you very much for all the help!!!!