Made some more progress today with using the Enterprise SDK as I’ve now solved the problem i was having with running Axis 1.1 on Tomcat 5.5. It turned out that in one of my web.xml files it was referring to a listener-class (org.apache.axis.transport.http.AxisHTTPSessionListener) which wasn’t found in axis 1.1 – hence the problem when tomcat tried to start up!! So all my own fault really!
I’ve now got the beginnings of my EnterpriseClient, but I’ve just got to now figure out how in the client I can get ‘hold’ of the whole xml string that has been returned from the EnterpriseServer, rather than just the component parts. Looking at the Plex example, using _responseHolder.value.getGroup() this returns a GroupDType object, which you can then extract parts from (eg getDataSource()), but I can’t see any way to just give the whole xml string that was returned by the EnterpriseServer in the first place. Will keep trying….!
Here are some diagrams of how we currently have things set up, and where we might go…
Current set up:
||This is how we currently have things working, unfortunately it’s not using IMS Enterprise Services in the communication between modules, it is just returning strings which are IMS Enterprise XML
Option 1 (see posting below):
||This is how we would ideally have the system set up, with an Enterprise Server in the centre, with a PHP library handling the interaction between Moodle and Enterprise Server.
Option 2 (see posting below):
||This is how we’re most likely to end up, with another java application inbetween Enterprise Server and Moodle. This Enterprise Client would be a client to the enterprise server, but it would be a server in Moodles eyes. We’re still undecided yet as to whether this would have a SOAP or REST interface provided out to Moodle.
Had good couple of days up in Bolton with Scott and at the ELF developers forum. We spent one day going through how to get the Enterprise SDK running, and although it’s not yet completely working I do feel i understand a lot more about it, and we’ve got some sample code which interacts with a database now.
The reason we couldn’t get it actually running was a problem between the different versions of Axis. The cetis-ws-client was built using Axis 1.1, and I’ve been using Axis 1.2, differences in the ‘constants’ package stop them being compatible with each other. So I thought I would try to switch to v1.1, but it I try to run with this I get errors when trying to start up tomcat (5.5), not sure why this is. So the plan is to update the client code so it can use Axis 1.2 instead – hopefully it’s not too much to change 😉
There are some other things for us to decide on too, mainly what to do about getting Moodle connected up to the Enterprise service and we’ve got a couple of options…
1) Build a PHP client for the Enterprise Service. With this option we’re really not sure how big a job this would be, it could be anything from couple of weeks to couple of months or more.
2) Build a client module which then provides a simpler interface for Moodle to connect to. This could be a ‘proper’ web service, or a rest type service.
My feeling is that we go for creating a rest client module for Moodle to connect to , as this ought to be the simplest to create. We need something simple and easy to do, as doing all this Enterprise stuff isn’t meant to be the focus of our project, and we’re in danger of spending all our time getting Enterprise Services working, rather than doing the grouping service!!
Not that I’ve started the standalone interface I’ve made quite a lot of progress. Using AJAX I’ve created a browse groups page, so you can collapse/expand groups to view the sub groups and the people who are members of the group, it all seems to be working quite fast – though I’ve not got large numbers of user or groups yet. Quite pleased that I’ve got this done
Spent most of the day today getting the KN moved from the old server to our new web cluster and database servers. Took a little while to do, especially as after the database was moved all the files needed to be reindexed, but the site seems much much quicker now so I’m very pleased with that. It also means we’ve got rid of the eWebEditPro inline html editor and are now using the FCKEditor instead.
Now that I’ve got most of the webservices etc sorted out for the JoinIn enterprise database, I started to look at creating the standalone interface for doing the grouping. I started off by creating a blanks struts application (on Tomcat 4.1- as I had been using for the JoinIN enterprise database), but soon noticed that I can’t use the filters in the servlet 2.3 spec that I’d have liked to have used for the page layout (header & footer), the reason being that the struts framework uses a forward to map the action in the URL to the actual jsp page. This functionality is only available in servlet spec 2.4, which then also means upgrading to Tomcat 5.5.
So, after a bit of ‘fun’, I’ve got both the JoinIn enterprise database/webservice and the standalone grouping interface now running on tomcat 5.5 on my tablet PC. I now need to make sure that I update the tomcat on our dev server and get both the apps running correctly on that too.
How a datasource is configured in tomcat 5.5 is slightly different to tomcat 4.1 too. Rather than creating a joinindb.xml file in the webapps folder to store the context data, this file must now be within the META-INF directory, called context.xml.
As I’ve been going through the IMS Enterprise and IMS Enterprise Services spec, I’ve got a number of questions as to how they should be used, or more what they should actually return (this is just a random collection of my queries!)…
1) Should the readPerson method return the persons’ group membership too – or should it only be the person record?
2) Should the methods which return group memberships return records of people who are implicitly in the group too? By this I mean if there is a parent Group P which contains a child Group C and person A is a directly listed as a member of C (but not of P), if I request all the members of group P, should person A be included? Or should it be up to the requesting system to make iterative calls to get this sort of information?
3) Some of the methods in the Ent Service spec appear to do very similar things, eg the readGroupsForPerson and readMembershipsForPerson both appear to return the same information, admittedly the XML format is different, but essentially the information you are getting from each is the same.
4) It seems a little odd that the formatted name is mandatory, but the component parts of the name are not, I would have thought it ought to be vice versa – as storing and using the component parts of the name is much more common and sensible!
5) There seems to be the potential for the group relationships to get into a loop (I’ve not seem anything yet in the spec that refers to this potential problem), as it seems possible (according to the spec), to have Group A being a member of Group B and GroupB to also be a member of Group A.
The answers to these are probably out there somewhere….!
Follow up discussion about the question of how to (or not to do!) XML parsing in different versions of PHP: http://moodle.org/mod/forum/discuss.php?d=43241
Getting on well with the development of the webservices for the Enterprise databases, and ought to have this about finished later this week. Then next week I can look at seeing how this maps across to the Enterprise SDK – I can use the same database and should to be able to reuse a lot of the code too (esp the parts that make calls to the database to retrieve data).
Another thing we’ve been looking at at is how we’ll do the XML parsing in Moodle using php. Most Moodle installations run on PHP 4 which doesn’t have built in XML functions, whereas PHP 5 does. There are libraries available for PHP 4 to do the XML parsing, but these (I think) would mean rewriting the code if we (and/or Moodle) moved to PHP 5. The alternative (so code didn’t need to be rewritten for different versions of PHP) would be to use regular expressions on the XML string – but that seems like a bit of a kludge to me!