This service lists the contents of the specified folder or report unit. The following sample request lists the contents of the
/ContentFiles folder in the repository:
Sample response:
When it lists a folder, the repository web service returns a set of resource descriptors: one for each resource that resides in the specified folder. Use / as the URI of the root folder.
Similarly, when it lists a report unit, the repository web service returns a set of resource descriptors that contain (at a minimum) the main JRXML source file. Since a resource in a report unit can be either a local resource or a reference to another repository resource, you should keep a few details in mind:
• | If a report unit data source is not defined locally, its wsType is set to datasource, which does not indicate the exact nature of the resource. Its type should simply be reference, but since the data source used by the report unit is a special child resource, it’s easy to recognize. The URI of the referenced resource is available in the PROP_REFERENCE_URI property. |
• | The main JRXML resource’s wsType is always set to jrxml, even if it’s a reference to an external JRXML resource. By looking at the PROP_IS_REFERENCE and PROP_REFERENCE_URI properties, you can determine where the resource is actually stored. The PROP_RU_IS_MAIN_REPORT property identifies the main JRXML source file of the report unit, even if the order of its children is altered. |
• | The purpose of listing a report unit is to get the list of the resources contained in the report unit. To retrieve the entire report unit (report unit resource as well as its children) at the same time, use the get service. |
The following Java sample illustrates wsclient as an instance of com.jaspersoft.jasperserver.irplugin.wsclient.WSClient:
PHP sample:
This PHP sample uses the client.php file found in the PHP sample provided with JasperReports Server. This file defines the most important constants you may find useful when integrating with the JasperReports Server web services, as well as useful functions that wrap the list, get, and the runReport operations.
The list operation also provides a shortcut to get the list of all resources of a given type in the repository, for example all the reports. This use of the list operation has the following syntax:
No value is needed for the LIST_RESOURCES argument. The value of the RESOURCE_TYPE argument can be any value of wsType except folder. The PARENT_DIRECTORY argument is the name of folder in which you want to look for resources. If you want to look for the resources in a branch of the repository, use the START_FROM_DIRECTORY argument.
Using LIST_RESOURCES is the only case in which a request doesn’t require a resource descriptor. |
Several Java methods in com.jaspersoft.jasperserver.irplugin.wsclient.WSClient use LIST_RESOURCES:
• | list(String xmlRequest) - Sends any custom request, including one using LIST_RESOURCES as shown above. |
• | listResources(String type) - Lists all resources of the given type in the repository visible to the logged in user. |
• | listResourcesInFolder(String type, String parentFolder) - Lists resources of the given type in the folder. |
• | listResourcesUnderFolder(String type, String ancestorFolder) - Lists resources of the given type in the folder and the entire tree beneath that folder. |
Recommended Comments
There are no comments to display.