+ Start a Discussion
Gurditta GargGurditta Garg 

generate and consume java web services in salesforce.



I'm newbie in Salesforce API's intigration, so could anyone please let me know how can i generate and consume java web services in salesforce. Actually i'm able to create wsdl using Eclipse for a java class but i'm not able to use it in salesforce, and i don't know whether its wsdl that the resource has to expose or something else.


PS : for example i've a java class which has functions for database interaction with some parameters and now can i create a interface in salesforce with some textboxes which would be actually the parameters for the functions that are written in java class (which would be actually our web service i believe).


Thanks in advance

Gurditta Garg

Mohith Kumar ShrivastavaMohith Kumar Shrivastava

Once you get WSDL for your Java Webservice use the following 


1)Go to classes >Generate From WSDL


2)Import your WSDL and parse to apex classes


3)From the generated stub class you will be able to make callout to your Java classes




Please follow the above link to understand more .

Gurditta GargGurditta Garg
thanks Mohit for your reply, actually i've to consume restFul web services in salesforce, WSDL2Apex i don't want to use.

thanks buddy
As Mohit had mention that slesforce provide the functionality to generate Apex Classes from WSDL so
once you logic in to slaesforce brows you WSDLs & generate Apex class out of it
it have all you method any eveyting
then just write a new apex class to to call you method of the generated apex classes

Note :- Salesforce won;t allow all kind of wsdl tag to be consume so there are some limitations while converting WSDDL in to apex classes

use below link for reference
Gurditta GargGurditta Garg
thanks for your reply, but i've to call restful services directly, the requirement is like this that i can't generate APEX classes using WSDL.


IF its a REST based web service so must have the End point URL and if it is seccried one you also have access token for access it

so simply make httprequest req = new httprequest();
req.endpointurl('<set your web service url hear>');

set the rest od parameter need to call you web service

httpresponce rep = new httpresponce();