Hi,
I wrote a C++ Server and Client, all worked fine as below
My .getStatus() and a more complex .recvRetQueryData(long,long,long) worked fine.
Code:case 'g': { // C++ (CLient.cpp) works int b = (int)fasBitComm->getStatus(); cout << "client: got status '" << b << "'" << endl; break; } case 'n': { // C++ (CLient.cpp) works int begrow = 0; int maxfetch = 2000; Demo::RetQueryData qdata = fasBitComm->recvRetQueryData(-1,begrow,maxfetch); break; }
Then I tried to make a Java Client (used ant and all compiled fine) The simple method .getStatus() that returns a byte works just fine BUT the more complex .recvRetQueryData(long,long,long) fails which returns a 'structure' that contains a variable that is a Sequence of another structure.
I end up getting an error as follows .. sort of stumped on what to do exceptCode:case 'g': { // JAVA (Client.java) works System.out.print("client 'g': \n"); byte b = fbprot.getStatus(); System.out.print("was : "+b+ "\n"); break; } case 'n': { // JAVA (Client.java) fails System.out.print("client 'n': \n"); long cn = -1L; long o = 0L; long m = 1000L; RetQueryData rqd = fbprot.recvRetQueryData(cn,o,m); break; }
slowly build up my entire *.ice file again.
My *.ice file is below "FbProt.ice" basically I am trying to return a RetQueryData to the Client which contains a Sequence of RetDataCol ( or a set of arrays or vectors that represent a column store where only one data type is active in any RetDataCol). I think this is the way to code up a union in ICE. As I said it worked in C++ but seems not to be happy in Java.Code:Ice.EncapsulationException reason = (null) at IceInternal.BasicStream.endReadEncaps(BasicStream.java:317) at Demo._FbProtDelM.recvRetQueryData(_FbProtDelM.java:138) at Demo.FbProtPrxHelper.recvRetQueryData(FbProtPrxHelper.java:261) at Demo.FbProtPrxHelper.recvRetQueryData(FbProtPrxHelper.java:236) at Client.run(Client.java:137) at Ice.Application.doMain(Application.java:200) at Ice.Application.main(Application.java:180) at Ice.Application.main(Application.java:118) at Client.main(Client.java:227)
Code:#ifndef FBPROT_ICE #define FPPROT_ICE #include <Ice/BuiltinSequences.ice> module Demo { /** define column stor types **/ enum RetDataType { eBoolSeq, eByteSeq, eShortSeq, eIntSeq, eLongSeq, eFloatSeq, eDoubleSeq, eStringSeq, eEOL }; struct RetDataCol { string mName; // name of data RetDataType mRetDataType; // must indicate which sequence this packet holds /** must have data in one of the below **/ Ice::BoolSeq mBoolSeq; // can be empty Ice::ByteSeq mByteSeq; // can be empty Ice::ShortSeq mShortSeq; // can be empty Ice::IntSeq mIntSeq; // can be empty Ice::LongSeq mLongSeq; // can be empty Ice::FloatSeq mFloatSeq; // can be empty Ice::DoubleSeq mDoubleSeq; // can be empty Ice::StringSeq mStringSeq; // can be empty }; sequence<RetDataCol> RetDataColSeq; /** define query return a squence of a single column or all columns **/ struct RetQueryData { byte mStatus; // 0 failue, > 1 success, long mBegRowId; // offset into RowId set long mNumRows; // number of rows returned long mMaxRows; // total number of rows, (done if mBegRowId+mNumRows == mMaxRows) long mPacketSz; // approx size of non-compresses data packet RetDataColSeq mRetDataCols; }; interface FbProt { byte getStatus(); RetQueryData recvRetQueryData(long col, long beg, long max); void shutdown(); }; }; #endif
Thanks in Advance,
Jon S

Reply With Quote
.
