The get operation is used to obtain information about a resource. In the case of file resources, such as images, fonts, JRXML files, and JAR files, the resource file is attached to the response message.
This method’s behavior differs according to the type of object specified:
• | Generally, a simple resource descriptor is returned. |
• | If you get a resource file, the file content is attached to the response; if you do not want the server to attach files to the response, set the request’s NO_ATTACHMENT argument to true. |
• | If you get a report unit, all the related resources are added as child resource descriptors to the report unit descriptor. |
• | To get an input control that is based on a query, you must set the IC_GET_QUERY_DATA argument to the valid URI of a datasource for the control, or you can handle the NONE condition as in the sample code java-webapp-sample. |
If you set the datasource in the input control, that datasource is used to execute the query and populate the resource descriptor. This can be useful when the input control must be rendered (for example, on a web page) in order to capture a value to pass when executing a report.
• | You can use parameters in the input control to select query values, including the datasource. See the examples starting on The IC_GET_QUERY_DATA argument gets the data from the data source.. |
The following sample request gets a file resource:
The service only uses the uriString to identify the resource to get and check for access permissions. This means that other information present in the resource description (such as resource properties, label, and description) are not actually used or required.
If a file is attached to the response, the returned resource descriptor has the PROP_HAS_DATA property set to true. By default, the attachments format is MIME. You can use DIME attachments by specifying the USE_DIME_ATTACHMENTS argument in the request.
A get call always returns a resource descriptor. If the specified resource is not found, or the specified user cannot access it, an error with code 2 is returned.
Java sample:
PHP sample:
The resource descriptor of an input control that includes data obtained by setting the IC_GET_QUERY_DATA argument to true would be similar to the following XML:
The query result is a set of rows that represents the full set of possible values for the input control. For each row, the repository web service returns the value that runReport expects for that particular option in the input control. Each row also includes the column values that should be displayed in the input control when prompting users.
Query Results |
This figure shows input controls based on queries, as they are rendered by the iReport Designer plugin for JasperReports Server. When the web services run report units, the rendering of input controls is left to the client application. The best way to proceed is:
• | Get the report unit. |
• | Check for query-based input controls by looking at the PROP_INPUTCONTROL_TYPE resource property or each child resource descriptor where wsType is equal to inputControl. |
• | Get each query-based input control by setting the IC_GET_QUERY_DATA argument to true. |
• | Render the input controls (if used in the report unit), being mindful of the input control properties (such as read only and mandatory). |
• | Call the runReport service and pass the user-selected values. |
The rows are stored in the PROP_QUERY_DATA resource property: for each row, a child resource property named PROP_QUERY_DATA_ROW contains the value and a set of children that contain the column values; these last resource properties are named PROP_QUERY_DATA_ROW_COLUMN.
The following schema may elucidate the whole data structure:
In Java, to simplify response processing, the resourceDescriptor class provides the getQueryData() method that returns a list of InputControlQueryDataRow, which is a convenient class containing all the row information (row and column values).
Recommended Comments
There are no comments to display.