4

Iam trying to call a external webservice from salesforce api or apex methods. For that we need WSDL document. From where i will get this WSDL file. 3rd party will provide this wsdl file or we can download from our salesforce org.. If this file from our salesforce org then which one we need to download(Enterprise/partner/apex wsdl)

Kindly provide me the solution to solve this....

Thanks, Murali

3 Answers 3

4

You need to obtain the WSDL from the external application. For example, for PayPal those are available here. So finding those WSDLs for the external service is the first step.

Note that it is very common that the WSDL will require some modification before you can generate Apex code from it using the "Generate from Apex" (wsdl2apex) button and in some cases you will not be able to use that approach at all.

Where a service also offers a RESTful API, that may be a better choice because you are less likely to run into hard to solve problems. Apex has good support for making HTTP requests and generating and parsing JSON.

2
  • @ Keith.. Thanks for your help...I have tried with HTTP requests and also got the result...Now iam trying to do it using wsdl.. Commented Sep 22, 2014 at 13:31
  • The PayPal WSDL will be a tough one to run through the native wsdl2apex tooling. Plenty of imports and extensions to be handled manually first. It would certain make your point about requiring modifications. Commented Sep 24, 2014 at 4:28
2

Calling an external system requires a WSDL from the service. There are certain rules the WSDL must abide by, mentioned in the Apex Web Services and Callouts page, under the Wsdl2Apex section. To import the WSDL, see Setup > Develop > Apex Classes > Import WSDL. Once imported, then you need to write Apex Code to actually call the external service. The aforementioned link also includes additional steps you need to take (such as adding a Remote Site setting).

2

It is true that for most real world WSDLs you will be investing (possibly significant) time in modifying the WSDL before the native wsdl2apex tooling will handle it.

I've been working on a tool that will automate many of the manual steps for you. Once you have your WSDL as per the other answers, have a look at the FuseIT SFDC Exporer. It is free to use, with a native Windows client and a more basic web version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .