Personnalisation avancée > Business Logic Customization > Deploying Arbortext Customizations > Anonymous Arbortext Access
  
Anonymous Arbortext Access
Process Overview
To host an XML Application in Windchill and use it from Arbortext Editor:
1. Create a zip archive of the custom directory structure.
2. Log in to Windchill, locate a Product or Library (or create one if needed), and then select the Folders second-level navigation for the container.
* 
Only Products and Libraries are supported. Other containers (Site, Org, Program, Project) are not supported by this feature.
3. Create a folder (if needed) to hold the Arbortext customizations. This folder can be at the top-level or it can be nested inside some other folder (at any depth).
4. Inside that same Product or Library, bring up the Preference Management utility, expand the Arbortext preference group, and locate the Customizations Folder preference.
5. Edit that preference and enter the name and path of the desired folder. Some example values are:
Value
Description
Arbortext Customizations
Top level folder with a space in the folder name.
Arbortext/Applications
Top level folder called “Arbortext” with a child folder called “Applications”.
Having set this preference, any WTDocument objects in the specified folder will now be available via anonymous HTTP. (specific details on constructing the URL will come later in this document).
6. Upload the zip file into the desired folder. When creating the document in Windchill, the “Type” and “CAGE Code” values do not matter.
7. Put the anonymous access URL for your archive into the browser and verify that you can successfully download the zipped archive. See the section “Anonymous Access URL Format” for information on the anonymous access URL.
8. Set the APTCUSTOM environment variable to the anonymous access URL for your zip archive and launch Arbortext Editor to use the customizations.
* 
For more information on zipped Arbortext customizations, see the "Deploying zipped customizations" section of the Arbortext Help Center (Programming > Arbortext Customizer's Guide > Custom applications > Deploying zipped customizations).
Anonymous Access URL Format
Type
URL Format
Library
http://server:port/Windchill/servlet/WindchillGW/com.ptc.arbortext.windchill.anonymous.AnonymousAccessDownloader/lib/orgName/libraryName/name[?params]
Product
http://server:port/Windchill/servlet/WindchillGW/com.ptc.arbortext.windchill.anonymous.AnonymousAccessDownloader/product/orgName/productName/name[?params]
* 
The folder name itself is not contained in the URL. The folder name is defined in the Customizations Folder preference. See “Configuring the Folder Path for Anonymous Access” section for information on setting this preference.
* 
As is normal for HTTP URLs, some characters, like spaces, colons, and non-Latin characters will need to be escaped in the URL; for example, space characters will need to be replaced with %20.
The name portion of the URL can be one of three things:
The object number in Windchill
The object name in Windchill
The filename of the underlying file. Generally, this is the originally uploaded file name.
Since folders in Windchill may contain multiple objects with the same name or underlying filename, the safest way to ensure you get the correct object is to use its number. Name clashes should be rare.
As an example, suppose you uploaded a file called hello.txt into this folder. The object name may be “hello”, an example object number may be “0000007324”, and the filename would be “hello.txt”. In this case, any of these could be used to specify this object in the URL.
When looking for an object to match the given string, highest priority is given to matching the number. If no matching number is found then a match against the first object with same name is done. If no matching name is found the, lastly, a match against the first object with the same filename is done.
In general, it is unlikely that there will be multiple objects with the same name or filename. But if that situation exists, the number can be used to safely access the desired object.
The optional combination of query parameters are as follows: The order of these parameter does not matter.
Parameter
Description
(no parameters)
The latest iteration from the latest version will be selected; not counting working (checked-out) iterations.
state
The most recent iteration from the most recent version that matches the given lifecycle state will be selected.
version
The most recent iteration from the specified version will be selected.
iteration
The iteration parameter is ignored. This is only used along with the version parameter.
state, iteration
The iteration parameter will be ignored. See “state” above.
state, version
The most recent iteration from the specified version that matches the given state will be selected.
version, iteration
The specified iteration from the specified version will be selected.
state, version, iteration
The iteration parameter will be ignored. See “state, version” above.
Examples of query parameter usage:
Query Parameters
Description
.../custom.zip.xml?version=C&iteration=2
Version C.2 of custom.zip
.../custom.zip?state=Approved
The most-recent version marked as Approved.
.../custom.zip?state=Approved&version=B
The most-recent version marked as Approved with a version of B.
.../custom.zip?version=B
The latest iteration in the B version.
If you specify the name of an object which does not exist in the folder, or no iteration of the object matches the given request parameters, the anonymous access URL will return a 404 response to the caller. This is normal HTTP behavior when the requested object is not found.
* 
Selecting the “Latest” Version
When dealing with versioned Windchill objects, the convention is that the “latest” object is selected by version and then by iteration. The latest iteration in version D will always be considered “newer” than the latest iteration in version C, even if that iteration was created more recently. For example, when browsing folder contents using the web UI, you’ll always see the latest iteration from the latest version, even if there are newer iterations in other versions.
The version selection for anonymous access URLs works in this way. For example, if the state parameter is specified without a version, and A.4 and B.2 both have the requested state, B.2 will always be returned regardless of when A.4 was created.
Objects Available for Anonymous Access
Although this functionality is primarily to allow Arbortext products to access Windchill-managed XML applications, other files types, such as word documents or text files can also be accessed. In order for the anonymous access URL to work, the target object must be a WTDocument object (or subtype thereof). You cannot access other Windchill object types, such as EPMDocument objects (CAD files or Arbortext Editor-created XML files) or WTPart structures.
Configuring the Folder Path for Anonymous Access
The Customizations Folder preference specifies the path to a folder that contains Arbortext customizations in a zipped format. The content from all Windchill documents in the specified folder will be made available without authentication via a specially constructed URL.
To set this preference navigate to Site > Utilities > Preference Management > Arbortext > Customizations Folder.
Site/Organizations : To disable anonymous access, set an empty value for this preference and select the Lock checkbox.
For Products/Libraries : Specify the path to a folder in this Product or Library that contains Arbortext customizations in a zipped format. An empty value for this preference means that no folders in the Product or Library are exposed anonymously
* 
For more information on zipped Arbortext customizations, see the "Deploying zipped customizations" section of the Arbortext Help Center (Programming > Arbortext Customizer's Guide > Custom applications > Deploying zipped customizations).
By default, this preference value is empty. If a Product or Library has an empty value for this preference then anonymous access is not allowed for that container.
One way for an administrator to forcibly disable this feature is to set and lock the preference at a Site or Org level to be an empty value. Due to the normal inheritance rules of Windchill, this will force all child Product and Library containers to also have an empty value for this preference and thus the feature will be entirely disabled.
Here are some example preference values:
Arbortext Customizations : Creates a top level folder named “Arbortext Customizations” which includes a space in the folder name.
Arbortext/Applications : Creates a parent folder named “Arbortext” with a child folder named “Applications”.
Suppose a non-empty value is set for this preference inside a Project or Program. That setting will have no effect because the feature does not work with those container types. To be more precise, there is no HTTP URL you can construct to access any such folder from these containers.
Suppose a non-empty value is set for this preference inside a Site or Org. This is actually undesirable because, due to the inheritance rules, all child containers will inherit this value (unless they override a specific value of their own). This will imply that any child Product or Library that happens to have a folder path that matches the preference value, will have that folder’s contents exposed anonymously.
When setting the value of the preference, an alert will be displayed if a non-empty value is assigned to a site, organization, project, or program container context. A non-empty value assigned to a site or organization container would force the value to each child container and could inadvertently expose material. A non-empty value assigned to a project or program has no effect and without an alert, a user could be confused at the unexpected result.
Listing Objects Available for Anonymous Access
You can generate list of objects that are available through the anonymous access functionality. This can help you determine if any objects have been exposed by mistake and can assist you in providing the HTTP URL for each object. Generating the list of objects available through anonymous access is restricted to users with administrator access.
To generate a list of objects being shared anonymously:
1. Open a Windchill Shell. SeeWindchill Shell for more information.
2. cd bin
3. ant -f anonymousAccess.xml listAvailableResources
4. Enter your administrator credentials.
Sample Output for Available Items
The output contains an entry for each document accessible via anonymous access and each entry lists the organization, container (product or library), and folder containing the document as well as the document name and a skeleton of a URL which can be used to access the document anonymously.
******************************************************************************
!+! STARTED @ Fri Oct 14 13:28:10 EDT 2011
******************************************************************************
Log file is '<Windchill>\Windchill\buildlogs\0000-anonymousAccess.log'

------------------------------------------------------------------------------
!+! ENTERING Anonymous Access
------------------------------------------------------------------------------

listAvailableResources:
[echo] ------------------------------------------------------------------
[echo] The following is a list of documents in Windchill that are exposed
[echo] to anonymous http access. Each entry lists the Organization,
[echo] Product or Library, and Name of the document as well as the Url
[echo] used to access it.
[echo] ------------------------------------------------------------------
[java]
[java] Organization: Demo Organization
[java] Library: New Library
[java] Folder: /Shared Folder
[java] Document: Lib Item 1
[java] URL: http://wcserver:1600/Windchill/servlet/WindchillGW/
com.ptc.arbortext.windchill.anonymous.AnonymousAccessDownloader/lib/
Demo%20Organization/New%20Library/Lib%20Item%201
[java]
[java]
[java] ------------------------------------------------------------------
[java]
[java] Organization: Demo Organization
[java] Product: GOLF_CART
[java] Folder: /Apps
[java] Document: Thing1
[java] URL: http://wcserver:1600/Windchill/servlet/WindchillGW/
com.ptc.arbortext.
windchill.anonymous.AnonymousAccessDownloader/product/Demo%20Organization/
GOLF_CART/Thing1
[java]
[java] -------------------------------------------------------------
[java]
[java] Organization: Demo Organization
[java] Product: GOLF_CART
[java] Folder: /Apps
[java] Document: Thing 2
[java] URL: http://wcserver:1600/Windchill/servlet/WindchillGW/
com.ptc.arbortext.
windchill.anonymous.AnonymousAccessDownloader/product/
Demo%20Organization/GOLF_CART/Thing%202
[java]
[echo] ------------------------------------------------------------------
[echo] Example:
[echo] http://MyServerName/Windchill/servlet/WindchillGW/
com.ptc.arbortext.
windchill.anonymous.AnonymousAccessDownloader/lib/ExampleOrganization/
ExampleLibraryName/ExampleDocName
[echo] ------------------------------------------------------------------
******************************************************************************
!+! FINISHED @Fri Oct 14 13:28:19 EDT 2011
!+! Log: <Windchill>\Windchill\buildlogs\0000-anonymousAccess.log
******************************************************************************

BUILD SUCCESSFUL
Total time: 9 seconds
Note that the example URLs do not contain actual hostname and web-app values because these values are unavailable through the command line interface. The URLs displayed are quite long and break across lines in the command prompt. Viewing the log file referred to at the beginning of the listing is an easier way of viewing the output.
This list includes all document objects being shared throughout your Windchill installation, including all products and libraries in all organizations.
Sample Output for no Available Items
There are three cases where no objects are exposed:
1. The Customizations Folder preference has been set to an empty value and locked at the site level.
2. No folders are exposed anonymously.
3. At least one folder is exposed anonymously, but it contains no WTDocument objects.
If no documents are currently being shared using the anonymous access functionality, the following output is generated:

******************************************************************************
!+! STARTED @ Fri Oct 14 14:19:59 CDT 2011
******************************************************************************
Created log dir <Windchill>\Windchill\buildlogs'

------------------------------------------------------------------------------
!+! ENTERING Anonymous Access[<Windchill>\Windchill\bin\anonymousAccess.xml]
------------------------------------------------------------------------------

listAvailableResources:
[echo] ------------------------------------------------------------------
[echo] The following is a list of documents in Windchill that are exposed
[echo] to anonymous http access. Each entry lists the Organization,
[echo] Product or Library, and Name of the document as well as the Url
[echo] used to access it.
[echo] ------------------------------------------------------------------
[java]
[java] No shared documents found.
[java]
[echo] ------------------------------------------------------------------
[echo] Example:
[echo] http://MyServerName/Windchill/servlet/WindchillGW/com.ptc.arbortext.
windchill.anonymous.AnonymousAccessDownloader/lib/ExampleOrganization/
ExampleLibraryName/ExampleDocName
[echo] ------------------------------------------------------------------
********************************************************************************
!+! FINISHED @ Fri Oct 14 14:20:23 CDT 2011
!+! Log: <Windchill>\Windchill\buildlogs\0000-anonymousAccess.log
******************************************************************************

BUILD SUCCESSFUL
Total time: 24 seconds