private OMElement processSingleRequest() throws DataServiceFault {
DataService dataService = this.getDataService();
String requestName = this.getRequestName();
/* set the operation name to invoke and the parameters */
DSOMDataSource ds = new DSOMDataSource(dataService, requestName, this.getParams());
/* check if the current request has a result, if so, return the OMElement */
if (dataService.hasResultForRequest(this.getRequestName())) {
/* pre-fetch data - only if streaming is happening */
if (!this.isDisableStreaming()) {
ds.prefetchData();
}
String resultWrapper = dataService.getResultWrapperForRequest(requestName);
String ns = dataService.getNamespaceForRequest(requestName);
OMElement responseElement = new OMSourcedElementImpl(new QName(ns,
resultWrapper), OMAbstractFactory.getOMFactory(), ds);
Query defQuery = dataService.getCallableRequest(
requestName).getCallQueryGroup().getDefaultCallQuery().getQuery();
/*
* Checks if the result has to be pre-built, because in situations like having an
* output-event-trigger, for XPath expression evaluations, the following operation
* must be done, or it wont work.
*/
if (defQuery.isPreBuildResult()) {
responseElement = DBUtils.cloneAndReturnBuiltElement(responseElement);
}
/* do XSLT transformation if available */
responseElement = this.executeXsltTranformation(responseElement, defQuery);
/* process events */
this.processOutputEvents(responseElement, defQuery);
return responseElement;
} else { /* if no response i.e. in-only, execute the request now */
try {
ds.executeInOnly();
} catch (XMLStreamException e) {
throw new DataServiceFault(e, "Error in DS non result invoke.");
}
return null;
}