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
niksssniksss 

Connecting from S2S using a sfdc webservice

Hi,

 

I am trying to connect from 1 sfdc instance to another using a webservice. The target instance however has login ip ranges on Profiles. When I try to make a connection via the sfdc webservice, I get an error for invalid ip range though this is from the authorized network. I think the issue may be, the IP Address of the machine used to call the webservice is not being considered for establishing this connection.

 

Any workaround for this? Do we need to include the SFDC servers' ip address range on the profile as well?

 

Thanks!

aalbertaalbert
Are you making the webservice call from Apex code? If so, the IP address will be from the SFDC server ip address range. Additionally, where are you storing the username and password to authenticate into the other org? Is it embedded in the Apex code? Be cautious because you can output the generated SessionId in the debug logs.
niksssniksss

hi aalbert,

 

Webservice call is through the Apex code. I added the SFDC server ip address range as well but face the same issue.   With regards to the username and password to authenticate into other org, what do you suggest so that the session id is not output in the debug log? Thanks 

aalbertaalbert

What error message do you receive?

In terms of outtputing the SessionId, if you have Callout log level set, you can see the HTTP request and response body, and the login response will include the SessionId. I ran into this a few months ago. 

 

Nonetheless, can you use salesforce 2 salesforce technology to connect the two orgs? What is the use case? 

 

niksssniksss

We dont want to user S2S feature since it would req lot of change management activities at both ends.

 

This is the error:

System.CalloutException:Web service callout failed: WebService returned a SOAP Fault:LOGIN_DURING_RESTRICTED_DOMAIN: cannot log in from current domainfaultcode=sf:LOGIN_DURING_RESTRICTED_DOMAIN faultactor=

 

We want to display all records visible to the user in the other sfdc instance in a separate frame. I didnt quite understand your solution for http request.

aalbertaalbert

I believe that error means that profile associated to the user making the login call has an IP Range restriction and the SFDC range is not listed. Is the SFDC IP Range added to the specific user's Profile to grant access?

 

Additionally, I still believe the sessionId is visible in the debug logs when the proper log level is set. Are these two orgs that you or the same company own? You wouldn't want Org A to see the sessionId of Org otherwise. Just be cautious about that issue. 

 

niksssniksss
Yes we have login IP ranges set on the user profile and I have also added the SFDC server ip address range onto the profile.