Here is a small discussion between Vaibhav & Deepak who both are MirchiMart team members. This discussion may help readers the ZKoss – OFBiz integration from OFBiz’s services call point of view. It assumes the basic structural knowledge of OFBiz.
We have used OfBiz as a full-fledged open source e-commerce solution in MirchiMart.com. The OFBiz natively uses XML screens & free marker templates for UI layer. If one wishes to use richer UI, then there is support for other frameworks as well. We used ZKoss as front end for MirchiMart.com because of its ready-to-use solutions & excellent Ajax support.
These two frameworks have been used together a few times before as well. Here is a wiki link to integrate ZKoss with OFBiz:
wiki link: https://cwiki.apache.org/OFBIZ/Zk-rich-client-integration-tutorial.html
Since, we wanted to expose only limited OFBiz services to our front end site, we created wrapper service classes which are mediators between ZKoss controllers & OFBiz services. Some days back while we were in early development stage, I had a few questions with Deepak who is leading the MirchiMart project.
Vaibhav: How are our services different from OFBiz services?
Deepak: There is an architecture level difference between OFBiz and ZKoss. While OFBiz has event, service based architecture. Zk leverages events and services as autowired, so one can say that OFBiz can be improved to use Zk framework as it’s easier & uses good Ajax.
Vaibhav: We don’t have any entries in Services.xml? Do they help OFBiz in running services at background / thread level?
Deepak: As per your question background and thread, there is no harm. OFBiz uses same delegator and dispatcher to call the services and events which we do in our services. It’s just OFBiz finds the name of the services and events in xml while we have mentioned them in our code.
Vaibhav: What is the advantage of Services.xml? It seems like an interface to me.
Deepak: This is how their framework works. They have tried to have most of the things in xml form and that’s also a good idea.
Vaibhav: So, I can say that we have converted xml files to Java interfaces?
Deepak: Right, OFBiz gives us multiple options for the implementations. Out of the box, you can write groovy, java, simple method, bsh, ftl… for anything from simple prototype to complex one.
Vaibhav: Anyways we are in initial development phase, once we are done with most of the development should we have Services.xml?
Deepak: Yes. OFBiz we have to learn to the deepest root. You can see that it’s an amazing product (as compared to Jd-Edward).
Not as a surprise, now we have converted a few static pages to screens & free marker templates (.ftl) with OFBiz style services. On the other hand, we also continue to use ZKoss for some of the complex pages. Thus, we enjoy the benefits of both the worlds.