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
Mike @ PartnersMike @ Partners 

Call to outside server/website from Apex page

I need to create an Apex page that incorporates information from and external website. I need to be able to make calls to the website. From what i have read there are two ways of doing this. 1- using the Ajax remoteFunction feature. I tried this method, but could only get it to work with Firefox. The other method i read about seems to work using Apex classes and a WSDL from the website you are making the calls to. I dont know where to go to find out how to make a WSDL for our website. Also, to make Apex Class you need a developers account. Im a little confused on how this works.

If you can point me in the right direction on how to make a WSDL for my server so i can upload it to salesforce so the two systems can talk that would be great. And also if you show me where to find info on the Apex classes and how to get a developers account and how to move the class between the two different salesforce accounts that would be great as well. Thank you for your help, and sorry for being such a newbie to Apex.

Mike
Jon Mountjoy_Jon Mountjoy_
Sorry I don't have time to answer all your questions Mike, but:
- you can get a developer account and start playing with web services here: developer.force.com
- I believe you can only include Apex in your org if you have a license for it - I guess talk to you salesforce point of contact about that
- For WSDL for your site, well - that's up to you really. We don't know anything about your site - ie. what technology it's written in, what language, etc. For example, if you're using Java then there are many approaches to creating web services - check out java.net, or Apache Axis for example.
- While the WSDL approach gives you formal SOAP web service messaging, you can also make callouts using HTTP methods. For example, see this article that shows how to make these types of callouts:
http://wiki.apexdevnet.com/index.php/Force.com%20Zillow%20Mashup
- If you go the WSDL approach, go to Setup/Develop/Apex and hit "Generate from WSDL" (I think, from memory) to generate Apex classes that map to your WSDL. Then to invoke the web service, you just need to call the Apex classes. Check out http://wiki.apexdevnet.com/index.php/Documentation for a lot of documentation.
- Check out the Force.com Migration Tool (also on developer.force.com for moving classes between orgs)

Hope that helps!
Jon
Mike @ PartnersMike @ Partners
Thanks for the reply. The http request class method works great. The challenge i am having now , is understand how to pass variables from the VF page to the apex class. This seems to be getting in to more of an object programing then im use to, so im a little fussy on all this.

I need to be able to have a button on the VF page, that when clicked it calls the http-request method. That method then needs to get different variables from the VF page (or they need to be passed to the method when it is called). I tried looking at the s-control way of calling and apex class, but it didn't seems to work. Would be best if i can send the variables when i call the method. The info that will be sent is dynamic and is not saved in SF. It is add onto the page from another http-request that is called when the page loads.

Any direction on where i can learn more about how to pass variables to the class would be great.

Thanks,
Mike
Jon Mountjoy_Jon Mountjoy_
You should be able to do that just fine in Visualforce.

I recommend starting with the Visualforce documentation that you can find here:
http://wiki.apexdevnet.com/index.php/Documentation

Also check out code samples/article on the wiki - hack around - then ask questions (if you have any) on the Visualforce forum.

Regards,
Jon