OK... one of the things that I've been trying to do over the last few days is to create a new mechanism for uploading and editing all the entries in my journal. Since I've put everything behind a router/firewall, I don't have easy access to all the ports of the server, and that's good, but also it limits what I can do in terms of creating a client for the Journal.
I remembered XML-RPC as one simple implementation of a remote invocation system that's transported completely on top of the web server's port/protocol. This then, would be ideal - since I have all the machines' web servers opened up through the router, and with XML-RPC I have the choice of platforms to write both the client and the server. I decided to go with PHP for the client and a native Cocoa app on Mac OS X for the client.
The choice of PHP for the server seems like a good one. I have all the database connectivity I need and the methods that I'm creating are small and pretty fast - even on the hardware that I'm using. I will admit that the docs were a little thin, but it didn't take more than a few hours to get my server running. Interestingly, I didn't know that it was running until I put the client together.
I have to hand it to Apple - they have put together some of the greatest tools I've ever used. In Jaguar (10.2) they had an implementation of XML-RPC in AppleScript and while it had problems, it was still there. Thankfully, the guys at Ranchero created another XML-RPC implementation for Jaguar that didn't have these issues. When I checked their latest Cocoa documentation pages, it seems that Panther (10.3) has a better XML-RPC implementation built into it. So I used that.
There were several issues with getting the data passed back to the caller - most notably, that the PHP arrays can't be passed as arrays in XML-RPC, at least not in the implementation that I got. They end up getting passed as associative arrays/structs and in Cocoa that's NSDictionary objects. Not obvious and certainly the most difficult part of the project. Once I knew what the data really was, iit was a simple matter of matching things up. Yet there was still one more problem.
While at work, I have a standard internet connection - meaning a DSL line behind a router providing NAT, etc. When I try to hit the web site as a simple web site the browser never really renders the page. If I use telet to the right port, the data comes back just fine. This means that the connectivity to the host is fine, it's something with the browser - in this case, Safari 1.2. Since the XML-RPC service is also based on the core web services that drives Safari, it's not surprising that it hangs as well. Very strange.
The result is that the reason for the creation of the server and client is is part of the problem. If I'm at home, then there's no hanging and no problems. Also, I can easily SSH from work to the box meaning that not all the tools/services are effected. A simpler solution may be to create an X11 app and then SSH into the box and run the app there. Seems sort of silly as text files work just fine. So maybe the solution is a few scripts that send and upload the files. Seems like if SSH is solid it'd be easier to do that, but it certainly isn't as interesting and fun as making the client/server work with some kind of protocol.
We'll have to see if I get any clues as to why this is happening and if it's even possible to clear this up. Looks kind of doubtful right now.