SOAPy MARC – Part 1

Success! I have actually managed to create an interface between the Microsoft Research task pane in Office 2003, and our Library catalog. I gave up on trying to accomplish this with Perl as Office never seemed able to connect to the functions. I downloaded nuSOAP for PHP and in about 15 minutes I was able to create the Registration service to add a search site to Office 2003. Once I discovered that I had that working I decided that it would be very easy to communicate with our library card catalog using Z39.50. There are multiple advantages to using a protocol such as that. The first advantage is a matter of portability. I should be able to re-use this setup on pretty much any Z39.50 compliant database. A second advantage to searching via Z39.50 is longevity. I do not think support for Z39.50 will be vanishing any time soon, which means it might just outlive the Research task pane in office, depending on Microsoft’s plans. The third advantage to using Z39.50 to talk to our catalog is that I already have code snippets from another project I came up with that I could reuse.
Once I had decided on Z39.50 to talk tot he catalog I got to work on deciphering the communications between Office and my program. The research pane in Office communicates using XML. The XML is based on multiple schemas many of which Microsoft invented specifically for this task. Once again I was able to recycle code from yet another project in the form of an XML parsing project in PHP. (Thanks again Kris Smith, for asking me to play with RSS feeds for pod casters.)
After a little bit of tweaking and some pretty sloppy code (hey it was really late) I was able to read the search requests and see what it was that I was asking for via Office. That success spurred me on and after a very loooong night of sleep coding I started in again the following morning. (Yes when I’m obsessed about something I have a habit of writing code, and debugging things in my sleep.)
The next morning I began the task of getting the Z39.50 code setup to perform a search. At this point I wasn’t even worried about returning useful data, just the number of hits on the search. After about an hour of digging though my old code, and a VERY helpful note I left for myself in the manual on PHP.NET I was able to return the number of hits to office. At this point I had what can loosely be described as an actual research service. Pretty useless, but it did perform a search and return data form an outside source. I now had to figure out the best method for parsing out the MARC record data. If you have ever seen a MARC record you would understand the “fun” involved in that. After looking at my options I decided to go hog wild and use XML for it as well. After all I already had the XML functions in use, so why not make them do double duty. Silly me… I think I should have just returned the record in Array form. It would have been much less of a headache. A few hours later though and a couple hung processes on the server and I was able to actually return real, honest to goodness data into the research pane in office. At this point I left it alone as it was 7pm after all and went home to sleep in prep for the next day.