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
gprasunagprasuna 

External webservice invocation from Apex class

Hi,

 

I am tryin to invoke an external webservice from apex class.But i am unable to do so.

 

I have a webservice method which takes two input parameters and returns a output. This webservice was deployed using apache axis and saved with .jws extension. Apache axis automatically generates the WSDL for this webservice.

 

Now i want to write a client application in my case i want the client to be salesforce.com . Saying that i would like to invoke the above mentioned webservice method from the apex class.

 

My question is :

 

How can i invoke that webservice method from apex class as we wont be having AXIS libraries available in the apex class. Please let me know the correct way to do this.

 

I tried to import the wsdl file of the webservice method that i want to invoke and generated an Apex class from it.

 

1. How can i Run this client apex class and view the response of the webservice method.

2. Should we create a client stub to make this possible.

 

Guide us through the correct way of doing this.

 

 

Thanks ,

 

Prasuna.

sd2008sd2008

I went through what you are doing now

I know how you feel.

Here is what you do:

 

1. have your webservice convert into Apex class.

 

2. write a global class which calls you apex class(webservice).

 

ex: global class whatever(){

         @future (outcall=true)

         public static void webserviceRun(put your parameters) {


   webservice.ServiceSoap dns = new webservice.ServiceSoap();
  dns.webservicefunction(put your parameters);
  }

3. to run it: whatever.webserviceRun();