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
random_duderandom_dude 

Apex class was generated from WSDL. what now?

I used the Generate from WSDL in Setup-> App Setup -> Develop -> Apex classes

It created a class from my webservice.

 

Now im confused about what the next step is.  How can I call my webservice functions from custom button presses, for example?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
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();

All Answers

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();

random_duderandom_dude

I have to do the exact same thing this tutorial shows.  (except with a different website)

 

 

Calling Web Services from Force.com

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();

This was selected as the best answer
aalbertaalbert

For starters, here is a great blog posting on how to call apex from a custom button.

Secondly, the Apex class(es) generated from the WSDL2Apex functionality, is just like any other Apex class. You need to instantiate the proper objects, set the proper variables or methods, then call the apex method that is your web service. Behind the scenes, Apex constructs the SOAP message and response and stores the data in the classes generated within that Apex class. 

 

More info here and here

random_duderandom_dude

Thanks for the quick replies.

 

That pointed me in the right direction