In my last post I talked about getting my code published as a PEAR package. Well, I did talk to them and they asked me to change my code a bit, add some PHPunit test, and to organize my directory in a different fashion. But, vacations are over and I have been too busy to make those changes. Yes, its been long since my last post. But, my first update after GSoC is here. I have changed the way I used to POST using cURL. Now, I am using HTTP_REQUEST2 to POST and send headers. As it says on PEAR, HTTP_REAUEST2 “Provides an easy way to perform HTTP requests”, more information over here (http://pear.php.net/package/HTTP_Request2).
Some PHPunit test, and a new package name is what I aim to do next.
The openSRF-PHP Library is ready and can be used to get response from an openSRF service using the services and methods present. There are two examples present, which will tell how to use the library. A documentation has also been added (https://github.com/pranjal710/osrf/blob/master/docs/doc.md) . The first part of the documentation describes functions, classes and their member functions, parameters passed and their return values. The second part of the documentation briefly describes what happens when someone uses the library i.e. the role of each class/function. My github repo is mentioned in the github tab.
Someone who helped me throughout, this library would not have been what it is now had my mentor Lebbeous Fogle-Weekley not helped me. I thank him for helping me by breaking the project into small parts and guiding me whenever I got stuck. There are a lot of things (which might be small for him) but were new to me, and they will surely help me throughout. Thankyou Sir, for editing my code, which cleaned it made it a lot shorter and for everything.
The next thing I am looking forward is to get it published as a PEAR package. My next post will tell about the changes I have done to get it Published as a PEAR package.
I tested my code to work correctly for service open-ils.actor. It gives an array, which is printed. I am currently working on my next task, which is to remove errors shown by php-codesniffer. I have already started working on it, and will update my repo as soon as I get rid of all those errors.
Although I completed this a week back, but I think now is the time to put this post. Do take a look at the newly added “examples/” in my github repo. “index.php” shows how to put a title level hold. The newly added config.php allows user to put his choice for the classfieldmapper.php’s location. This is necessary because the file is being created dynamically and requires permissions to read/write. The location has to be chosen wisely. Another newly added option, although the same is present for other language binding (and I couldnt think of anything new), is to explicitly control the parsing of Fieldmapper IDL. It takes few seconds to parse fieldmapper idl, hence, to make things faster user is given the option to parse/not parse the IDL. If the xml file is changed/edited, the user can create a new, for other cases he an continue with the old copy.
The code has been currently tested for “title level hold” only. My next step will be to test it for various other cases.
The newly added files in my github repo correspond to the fieldmapper_IDL. The parse_xml_2_array.php picks relevant data from the /server/reports/fm_IDL.xml, and dynamically create an associative array. This array is then used by fieldmapper.php to create all classes dynamically and write it to classfieldmapper.php. classfieldmapper.php also includes an abstract class called fieldmapper_class_abstract.php. There is a function which encodes a fieldmapper class object to json, and another which does the opposite. Thus, now we can directly use the services and methods for all required functions.
I also tried to clean and indent my code.
After going through the login( ) from Open-ILS/src/python/oils/utils, I have come up with my open_ils_login( ). This does the same work. Although it returns an array, and, “textcode” describes about “SUCCESS or “login failed”.
My codes had a lot of includes/require with vague class names and file names. I worked on them as well.
Now a user, upon successfull login gets an authentication token. My next post will talk about placing a title-level hold on a bib record.
Code at https://github.com/pranjal710/osrf
Really sorry, since I missed a few very important things in my last update. I just briefed up everything, and forgot to mention work done by few people who helped me, and I accept, this was not at all good of me. Hence, here it comes, https://github.com/edoceo/osrfphp and https://github.com/tadl/opensrf-php were of great help. Also, a mail by Bob Wicksall to the firstname.lastname@example.org was a godsend.
Thankyou All 🙂
(Update till now, quickly) I installed opensrf 2.1 on ubuntu 12.04, and started working on it. It took me a while to understand the working of srfsh, and opensrf.Now, since I got a bit of grasp, I began my work on the php client. A hurdle turned up, HTTP is stateless on its own. So how do we have a statefull session?? This obstacle was removed through this wiki. And, now I had successfully established a connection with the service. Though this cannot be *correctly* stated as “connection”. It is sort of sending the data and recieving a response, along with a guid. All responses are individual response. The guid keeps a record of the thread.
Till now I have been using “evergreen.owwl.org” as my endpoint. After editing my code to get a more generic client, I have come to this day(today), with my commits available on github (/pranjal710/osrf). To get a better client, which can perform on more services, now, I had to install an evergreen system. I did that (evergreen 2.1.2). For those who cannot figure how to do this (2.1.2 on ubuntu 12.04), and are stuck at : “make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_90” , do try :this for the *Makefile.install* (at your own risk), but yes, it did work for me.
PS : Sending header and receiving response data took a lot of time (and patience)
Welcome aboard! Although a bit late, but better late than never. This blog aims at showing my progress in this year’s GSoC.