Chapter 7 SOAP - Domain Web Service
7.2 Operations in the Domain Service
7.2.2 The executeDomainQuery Operation
The executeDomainQueryoperation takes these parameters:
domainUri - a string containing the path to the Domain on the server, for example /domains/John/ExpenseDomain.
queryStr - a string containing the Domain query composed of fields and a filter expression (see below for the syntax).
localeStr - a string giving the user locale, for example en, en_US, or es_ES_Traditional_WIN.
dateFormatStr - a string giving the date format desired in date fields, for example MM/dd/yyyy or h:mm a.
The query string is composed of the following elements that create a syntax for the Domain query:
<query> - encapsulates the whole query.
<queryFields> - contains a sequence of <queryField> elements. The order of fields will be preserved in the results.
<queryField id="<fullyQualifiedID>" /> - an empty element where <fullyQualifiedID> gives the unique identifier of an item you want to appear as a column in the results. The identifier must be fully qualified, which means it includes the identifiers of the set and super-sets to which the item belongs. The fully qualified identifier is similar to the path of the item in the Domain, using a period (.) to separate each set identifier.
<queryFilterString> - the filter string for the query uses an application-specific syntax called Domain Expression Language (DomEL).
The following example shows a filter string that must match two values
:
Note that when the query string appears in the SOAP example below, special characters such as < and > are converted to their corresponding character entities, < and > respectively.
The executeDomainQueryoperation returns results in the following objects:
ResultSetData. Encapsulates the results of the Domain query. It contains column names and rows of data:
names. Array of column names in the result set. These names match the order and items in the query fields.
data. An array of data rows.
DataRow. Represents a record and contains values for each column in a row:
data. An array of strings, one for the value in each column, in the same order as the names array.
Be sure the format has date and time portions if you expect to have both date and time fields, for example yyyy.MM.dd G 'at' HH:mm:ss z
<query>
<queryFields>
<queryField id="expense_join_store.ej_store_store_city" />
<queryField id="expense_join_store.ej_store_store_country" />
<queryField id="expense_join_store.ej_store_store_name" />
<queryField id="expense_join_store.ej_store_store_state" />
<queryField id="expense_join_store.ej_store_store_street_address" />
</queryFields>
<queryFilterString>expense_join_store.ej_store_store_country == 'USA' and expense_join_store.ej_store_store_state == 'CA'</queryFilterString>
</query>
Note that all values are given in string format.
The following example shows the full SOAP request for an executeDomainQuery operation on a sample Domain:
The response to the request contains the current values in the specified Domain:
<?xml version="1.0" encoding="utf-8"?>
<queryStr xsi:type="xsd:string"><query> <queryFields>
<queryField id="expense_join_account.ej_account_account_description"
/>
<queryField id="expense_join_account.ej_expense_fact_account_id" />
<queryField id="expense_join_account.ej_account_account_parent" />
<queryField id="expense_join_account.ej_account_account_rollup" />
<queryField id="expense_join_account.ej_account_account_type" />
<queryField id="expense_join_account.ej_account_Custom_Members" />
<queryField id="expense_join.ej_expense_fact_amount" />
<queryField id="expense_join.ej_expense_fact_exp_date" />
7.2.3 Java Client Classes
The JasperReports Server web service includes classes in JAR files that can be used by Java clients to easily communicate with the Domain web service.
Java bean classes for the XML types declared in WSDL (for example, SimpleMetaLevel, SimpleMetaItem, ResultSetData and DataRow) are located in ji-common-ws-server-4.1.0.jar in the
com.jaspersoft.ji.ws.axis2.domain.generate package. Instances of these classes can be used to communicate with the Domain web service.
<names xsi:type="xsd:string">expense_join_store.ej_store_store_type/>
<names xsi:type="xsd:string">expense_join_store.ej_store_store_street_
address/>
<names xsi:type="xsd:string">expense_join_store.ej_store_store_city/>
<names xsi:type="xsd:string">expense_join_store.ej_store_store_state/>
<names xsi:type="xsd:string">expense_join_store.ej_store_store_postal_code/>
</names>
<data soapenc:arrayType="ns1:DataRow[600]" xsi:type="soapenc:Array"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<data xsi:type="ns1:DataRow">
<data soapenc:arrayType="xsd:string[31]" xsi:type="soapenc:Array">
<data xsi:type="xsd:string">Marketing</data>
<data xsi:type="xsd:string">4300</data>
<data xsi:type="xsd:string">4000</data>
<data xsi:type="xsd:string">+</data>
<data xsi:type="xsd:string">Expense</data>
<data xsi:type="xsd:string" xsi:nil="true"/>
<data xsi:type="xsd:string">1884.0000</data>
<data xsi:type="xsd:string">01/01/1997</data>
<data xsi:type="xsd:string">HeadQuarters</data>
<data xsi:type="xsd:string">1 Alameda Way</data>
<data xsi:type="xsd:string">Alameda</data>
<data xsi:type="xsd:string">CA</data>
<data xsi:type="xsd:string">94502</data>
<data xsi:type="xsd:string">USA</data>
</data>
</data>
...
</data>
</executeDomainQueryReturn>
</ns1:executeDomainQueryResponse>
</soapenv:Body>
</soapenv:Envelope>