Hi
I am running a LiveReport using the webservices (16.2.12) with java. The actual call is successful, but I cannot access the actual values of the rows' fields using the casting mechanism as highlighted in this post.
The result in the web UI is correct:
However, the code (see attached based on the above post) returns only the keys:
DATAID =
DATAID =
It seems that the DataValue instances cannot be cast to any of the PrimitiveValue subclasses. It should be an IntegerValue, buta the test for d instanceof IntegerValue
returns false. Strangely, the SOAP resonse seems correct, i.e. indicates these values as xsi:type="IntegerValue"
:
<?xml version='1.0' encoding='UTF-8'?>
<s:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns="urn:api.ecm.opentext.com" xmlns:h="urn:api.ecm.opentext.com" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<h:OTAuthentication xmlns:h="urn:api.ecm.opentext.com">
<AuthenticationToken>****</AuthenticationToken>
</h:OTAuthentication>
</s:Header>
<s:Body xmlns="urn:DocMan.service.livelink.opentext.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunReportResponse xmlns="urn:DocMan.service.livelink.opentext.com">
<RunReportResult>
<Contents xmlns="urn:Core.service.livelink.opentext.com">
<Description xmlns="urn:Core.service.livelink.opentext.com"/>
<Key>1</Key>
<Values xsi:type="IntegerValue">
<Description>DATAID</Description>
<Key>DATAID</Key>
<Values>24244513</Values>
</Values>
</Contents>
<Contents xmlns="urn:Core.service.livelink.opentext.com">
<Description xmlns="urn:Core.service.livelink.opentext.com"/>
<Key>2</Key>
<Values xsi:type="IntegerValue">
<Description>DATAID</Description>
<Key>DATAID</Key>
<Values>24244437</Values>
</Values>
</Contents>
<IsLimit>true</IsLimit>
<SubReportID xsi:nil="true"/>
<Title>Test</Title>
</RunReportResult>
</RunReportResponse>
</s:Body>
</s:Envelope>
For reference, here's the method to run the report:
public void run(Long uid) throws Exception {
ReportResult result = openTextConnector.getDocumentManager().runReport(uid, null);
List<RowValue> rows = result.getContents();
for (RowValue row : rows) {
List<DataValue> data = row.getValues();
for (DataValue d : data) {
Object objVal = getDataValue(d);
System.out.println(d.getKey() + " = " + objVal.toString());
}
}
}
private static Object getDataValue(DataValue d) {
Object retVal = null;
if (d instanceof IntegerValue) {
IntegerValue ival = (IntegerValue) d;
if (ival.getValues().size() > 0)
retVal = ival.getValues().get(0);
} else if (d instanceof DateValue) {
DateValue dateVal = (DateValue) d;
if (dateVal.getValues().size() > 0)
retVal = dateVal.getValues().get(0);
} else if (d instanceof StringValue) {
StringValue strVal = (StringValue) d;
if (strVal.getValues().size() > 0)
retVal = strVal.getValues().get(0);
} else if (d instanceof RealValue) {
RealValue strVal = (RealValue) d;
if (strVal.getValues().size() > 0)
retVal = strVal.getValues().get(0);
} else if (d instanceof BooleanValue) {
BooleanValue strVal = (BooleanValue) d;
if (strVal.getValues().size() > 0)
retVal = strVal.getValues().get(0);
}
if (retVal == null)
retVal = new String();
return retVal;
}