Cannot access the cell values when parsing the results of a livereport

Options

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;

   }

Tagged:

Comments

  • Appu Nair
    edited March 6, 2021 #2
    Options
    Long moons ago when livelink was in its 9 or 10 avatar I provided the KB two easy to follow parsing
    I have no idea if this will work but at the time they used to


    https://knowledge.opentext.com/knowledge/cs.dll?func=ll&objId=39663024&objAction=Open&nexturl=%2Fknowledge%2Fcs%2Edll%3Ffunc%3Dll%26objId%3D19713021%26objAction%3Dbrowse%26sort%3Dname%26viewType%3D1

    https://knowledge.opentext.com/knowledge/cs.dll?func=ll&objId=39660740&objAction=Open&nexturl=%2Fknowledge%2Fcs%2Edll%3Ffunc%3Dll%26objId%3D19713021%26objAction%3Dbrowse%26sort%3Dname%26viewType%3D1


    You might also want to put autolivereport and include another column say name and see if strings are coming through

    I assume your LR is something like select top 10 DataID from. DTree

    In C# and java you can also look at the returned output and use its inspector function to actually type the debugged line so you can try your casting etc as well






    Ciao, Appu
  • Hi Appu

    Thanks for the input. I've been told that the REST API is the way to go nowadays, but it would be great if the current developments on the webservices would still work for the time being.

    "Auto LiveReport" is on. I've added different columns (reduced it for the test case given here), and both StringValue and DateValue fields are correctly given in the response. I've also debugged directly, but that could't indicate a clue on the missing piece for the casting - no PrimitiveType would work.

    I have a feeling it might be connected to jax-ws classes/versions of it, but it's difficult to identify. At least, I've tried with Java 8 and Java 11, but that didn't make a difference.

    Thanks again, continuing the quest...

  • Hi docuteam,

    Are you saying that StringValue and DateValue work properly but IntegerValue doesn't? What version of Content Server/Livelink was used with wsimport to generate your client side stubs?


    -chris

  • Hi Chris

    No, sorry for not being clear: None of the PrimitiveTypes do work. As indicted, build 16.2.12(.1159) is used, which I think corresponds to CS 20.2.

    $ wsimport -fullversion

    wsimport full version "JAX-WS RI 2.2.9-b130926.1035 svn-revision#8c29a9a53251ff741fca1664a8221dc876b2eac8"

    Kind regards,

    Andreas

  • In your code would you be able to output the value of:

    d.getClass().toString()

    and, just for completeness, the value of:

    IntegerValue.class.toString()


    Thanks,

    -chris

  • Hi Chris:

    Sure, I get:

    class com.opentext.livelink.service.core.DataValue

    class com.opentext.livelink.service.core.IntegerValue

    For the adapted code:

       private static Object getDataValue(DataValue d) {

           System.out.println(d.getClass().toString());

           System.out.println(IntegerValue.class.toString());

           ...

    Best, Andreas

  • I'm currently following up on the impression that it's something to do with JAX-WS versions/dependencies that might be conflicting/incompatible...

  • One thing I remember that OT gurus like@sıɹɥɔ Kyle Swidrowich would stress is when SOAPUI says something that does not translate fully into java and .net stuff. You will find lots of examples in the old forums saying what could I do if SOAPUI says this and how to cast it.

    I see that you got @sıɹɥɔ (yes he is one of the Gurus :) interested so he will probably identify what is wrong with your code :)

    see Jason Smiths reply if this is closer to what you are running into

    relevant from that

    "Take a close look at how the values are set from the template when creating the document. Notice that each DataValue is first casted into the actual data type instead of referencing it by the parent DataValue type. The key here is that the parent does not define the values, they are only defined in the sub classes, which is why you cannot work directly with the DataValue object."


    #AOTDEV3D

  • Hi Andreas,

    There's nothing wrong with your code to cause this problem; I've run it against my 16.2 system successfully. I agree it's strange that the items are apparently being instantiated as DataValue's on your system, especially for the xml you showed.

    Appu -- doing a magnificent job in these forums as usual -- found a thread showing a few people experiencing the same situation as yours. Those were from 8 years ago though, and that's partly why I was asking about your use of wsimport: I wanted to be sure you weren't using an old jar file that originated with the use of wsimport on an older version of Content Server. In addition I agree with your concern about other jars that may be on your path for jax-ws (jaxb, etc.) that may be playing a role here.

    Opening a Support ticket may be your best hope in order for detailed configuration and environment debugging to be performed.


    Thanks,

    -chris

  • Hi Chris

    Thanks so much (also to Appu) for all this feedback, I really appreciate it!

    I'm quite sure by now it's related to the JAX-WS libraries used. I was using the wsimport version indicated above, but switched to the most recent version of the jaxws-maven-plugin, too, to ensure I am generating and using newly created classes.

    May I ask which versions of jaxws runtimes etc you are using for your successful tests?

    Kind regards,

    Andreas

  • Just to update on my progress: It seems to work after downgrading jaxws-rt and jaxb to 2.2.x.

  • Hi Andreas,

    I've run your code with Java8 and its (native) jax-ws 2.2, and with Java11 and (now jakarta) jax-ws 3.0. All OK, and unfortunately not reproducing your error.

    At least you've a workaround that's hopefully useable. (It has to be better than trying to debug library dependencies!)


    Thanks,

    -chris