+ Start a Discussion
David SomekhDavid Somekh 

Newbe to Apex-Java integration.

Hi All!

I know Java and I know Apex But I really don't understand the way they work together!

I took a look in Cookbook ect. but I can't fint a step by step or just a good tutorial that explains

the steps to create:

1. Java code that will be called from Apex. (In my case it has to be apex trigger).

2. How to call Apex from Java code?

 

The questions are very general but I could really hep if I could find some tutorial that explains what and how to install in order to get this thing working.

 

Thank you!

 

SCWells72SCWells72

I'm fairly new to this as well so take my answer in that context, but assuming you're not using VMForce (and I'm still not clear how Java and Apex inter-operate in that environment), your Java portion has to live somewhere else in the cloud, likely your own data center or hosting service.  Then you basically expose your Java business logic through SOAP, import the WSDL for those services into Force.com, and invoke them from Apex using callouts.

 

Force.com maintains SOAP CRUD services for your business objects (both out-of-the-box and custom) as you create/customize them.  When you need to have the Java side call into the Force.com side, you can download the WSDL for your app (Enterprise for strongly-typed or Partner for loosely-typed) and use something like CXF or Axis2 to create Java client stubs.  At that point you can manage your Force.com objects remotely.

 

If by chance you were asking about how Java and Apex play together in a VMForce environment, I'm curious to know the answer as well!  That's one of the next things I need to evaluate so I'm hoping to gain access to the EA soon.