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
KpSinghKpSingh 

Calling webservices from Apex class

Hi,

 

I have services on  Axis1.5. How can we call from Apex class or Visualforce page.

 

 

Thanks,

Sunil

 

Jamz_2010Jamz_2010

Hi Sunil,

 

To call an external web service from within Salesforce you must first obtain the WSDL of the service you wish to call - this can usually be done by adding ?wsdl to the service URL (for instance if the service is http://myserver/axis/myservice?wsdl). This file that you are given is what defines you web service to other systems which may wish to call it (you can get WSDL's of any global apex method that is define as a webservice to allow you to invoke Salesforce from an external system). Once you have this file, in Salesforce you can import the WSDL to make an apex class (using the generate from wsdl button). If you follow the on screen instructions you should end up with a new apex class that defines the web service (you may need to iron out some issues with the WSDL import). Finally, you can then call this class from within any apex method to invoke the web service or you can use an @future(callout=true) method to call it if you want to ensure a speedy response for the user. The only other point I would make is watch out for how many API calls you do as you are limited to 1000 per user per day (with a minimum of 5000) and a maximum of 1,000,000. Also, you are limited to 10 future calls per apex thread.

 

Hope this helps

 

James