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
mandycmandyc 

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;

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

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

 ssu.IsActiveSpecified = true

All Answers

SuperfellSuperfell

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.

mandycmandyc

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?

 

 

 

 

SuperfellSuperfell

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

 ssu.IsActiveSpecified = true

This was selected as the best answer
mandycmandyc

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