I have implemented SSO among two ORGS. I have made a web services class in my service Org. Can I hit that web service from my Identity provider Org using rest callout? I tried it by making a http get request which for which I use following URL pattern (service Org Url + Urlmap to Web service class) as a response I got 302 status with updated URL, Too handle this I used following code.
while (response.getStatusCode() == 302) { request.setEndpoint(response.getHeader('Location')); System.debug('END Location isi '+response.getHeader('Location')); response = new Http().send(request); } I was hitting this point https://cloudce-13a-dev-ed.lightning.force.com/Case/abc but it redirected to https://cloudce-13a-dev-ed.my.salesforce.com/Case
finally 404 response returns.
/services/apexrest/Case/abc. As written, I'd expect a 404 here.