macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Applying "Digital Hub" Concepts to Enterprise Software Design, Part 4
Pages: 1, 2, 3, 4, 5, 6

A Round-Trip Test

All that remains now is to give our application a spin.

  1. Build and run your application by pressing Apple-R.

  2. The application should launch a browser window with your application. I recommend using Internet Explorer (IE) for this, since IE has a nice XML viewer. You can copy and paste the URL into IE if it launched in Safari by default.

  3. Right-click (or Ctrl-click) the hyperlink and choose "Download link to disk." Save the XML in a location you will remember.

    Right-click (or control-click) the hyperlink and choose "Download link to disk." Save the XML in a location you will remember.
  4. In the freshly downloaded XML, copy, paste, and modify some of the item nodes using a text editor. This will simulate new data. Remember to delete the id value for the new nodes so that the application will know that they are new. Here is the XML that I am using if you would prefer not to create your own. Note that it is okay to add line breaks and white space, if this helps you to manage the XML.

  5. Go back to your application in the web browser. Click the Browse... button and select the XML containing the new data items. Click Submit.

    Go back to your application in the web browser. Click the Browse... button and select the XML containing the new data items. Click Submit.
  6. The Results item should indicate the successful parsing of the XML file.

  7. Click the hyperlink again to generate fresh XML from the database. You should see your new data items. Notice that, unlike the XML you uploaded, they now have id numbers assigned.

    Click the hyperlink again to generate fresh XML from the database. You should see your new data items. Notice that, unlike the XML you uploaded, they now have <code>id</code> numbers assigned.

Adding Web Service Support

Besides accessing the XML through a web page, it would be nice if the tools we plan to create could also request and submit XML via a web service. I will demonstrate this remote interaction in a future article. For now, let us add this functionality to our "hub" application. It's easy!

  1. Add the following line to the end of the Application function in the Application.java file:

WOWebServiceRegistrar.registerWebService(XML.class, true);
  1. Here is a link to the complete Application.java file.

Isn't WebObjects great? That single line of code will allow applications to connect to the XML class via web services!

Extra Credit

There are a few features that would be nice, but I left out for the sake of brevity. If you're feeling ambitious, you could add them yourself. The first is to allow imported XML to add measureTypes to the database. The second is to allow modification of existing data. Actually, if this project was a real assignment, we probably would not want to add either of these features to protect the critical data already in the database, but it would be a good programming exercise to add this functionality.

In the next article, we will build a Cocoa application to facilitate data entry. Stay Tuned!

Resources

Adam Behringer works as the CEO of Bee Documents, which strives to help legal and medical firms efficiently manage their documents.


Return to the Mac DevCenter