AppleWebObjects

 

In trying to find out what tools exist to create WebServices I came across the Apple WebObjects system. This is an amazingly simple way to create WebServices to access tables stored in databases like MySQL.

Here's what I did to create WebServices that can query the database(s) used by the Aus-VO SkyCat service:

  • Run the Apple EOModeler (EO = "Enterprise Objects") application. Create a new model, using JDBC to access the database, and setting the JDBC connection properties using the username and password for the SkyCat database, and a URL of the form jdbc:mysql://databasehostname.etc.edu.au/databasename. The EOModeler connects, and determines a model for the database. It may be useful to enable query and return of "key" fields - this is done by making sure there is a diamond next to each fieldname of each table. Save the model and quit EOModeler.
  • Run XCode, and create a new project based on the "Direct to Web Service" template. Provide the name of the saved EOModel. Under Resources->Properties, set WOAutoOpenInBrowser to false, and WOPort to 55555. Build and run the project, and after a few seconds you should see in the run output window the message Waiting for requests... .

At this point, you have a running WebService, but there are no specific "ports" or methods you can call. They are set up by running the Apple WebServices Assistant application. This is really very clever. It connects to your running service, learns about the data model, and then lets you construct "services" and "operations", where the latter are basically methods to access content from the database. It can write code for you, but unless you need to edit the code, all it does is create some "rules" that get turned into code only in the build process in XCode. These rules are stored in the file user.d2wmodel in your XCode project directory.

  • Run the WebServices Assistant application and connect to localhost:55555 (or another port if you changed it in the properties file). Create a new service, give it a name, and make the desired table entity public. Now you can add one or more "operations" (methods). Click "New Operation", give it a name, select the desired data table source, and "OK". Now you can configure method arguments by simply selecting fields from the box on the right, and selecting a simple selection rule (eg. "<"). You can search multiple times on the one field by using different "public name"s for it. Configure method return values in a similar way, and click "Save" (top-left). You can test your web service by clicking the "Test" button which after a moment will give you a simple user interface to provide the required arguments to the method.
  • You can quit WebServices Assistant now, and fetch the wsdl easily, or connect the WebService from your client environment, eg. Python. The form of address for the WSDL file and the WebServices is listed in the run output under XCode.

Things left to explore...

  • can I build the above web service in a servlet and deploy on Tomcat? Under Linux? There is a howto for this here.
  • can I add VOTable wrapping to the extracted data before shipping it to the client?

-- DavidBarnes - 27 Oct 2004