I use URL's quite extensively for Ajax and other non-Integration Broker integrations (NEVER HARD CODE URL'S!). PeopleTools provides a couple of ways to store URL information. The most well-known of these features is the URL definition (PeopleTools > Utilities > Administration > URLs). URL Definitions are great for relative URL's, but I'm not fond of storing fully qualified URL's in this manner. Here is why...
Imagine having 5 URL's that point to different resources on the same server and then one day the server's host name changes. Because of this change I have to modify 5 URL definitions. What if I forget one?
An alternative is to store the base URL in a node definition and then the relative portion of the URL in a URL definition. Creating a fully qualified URL in this manner requires concatenating two definitions: the node URI and the URL definition. Next Question: How do I access these Meta-data objects from PeopleCode? Most of us are familiar with the
GetURL PeopleCode function, but what mechanism does PeopleCode offer for retrieving a node's Content and Portal URI?
A PeopleSoft instance's node definitions are accessible through the
%Session object. The
Session object contains a method named
GetNodes which returns a collection of the instance's node definitions. A call to the collections
FindItemByName method returns a reference to a single node, which, of course, has properties of its own. Putting this all together, returning the Portal URI of a node named UCM would require PeopleCode that looks something like:
Local string &serverUrl = %Session.GetNodes().ItemByName("UCM").PortalURI;
By centralizing the base portion of the URL in a node definition, we save some administration overhead.