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
adsfasdfasdfasdadsfasdfasdfasd 

Calling an Apex webservice from Apex

I have an Apex webservice running in one org, and I want to make a call to that Apex webservice from some Apex code running in a completely different org.

 

1. Can I do this?

 

2. How?

 

I know the Apex webservice is working properly because I am already calling it from a C# application. I want to consume the same webservice from an Apex application now.

 

Thanks,

 

John

adsfasdfasdfasdadsfasdfasdfasd

I've gotten part of the way there. First, I generated the WSDL for the Apex webservice in the first org. Then I went to the second org and generated Apex classes from that WSDL. Now I'm writing Apex code to call the webservice and it's compiling, at least.

 

New question:

 

From my C# application, I login first and then make my webservice calls. To do this, I have hard-coded the SF user credentials in the application.

 

Do I need to do this from Apex, since I am access the webservice in a completely different org?

 

Thanks,

 

John