Author |
Message
|
vanshul |
Posted: Tue Jun 10, 2014 10:05 pm Post subject: Issue while calling java function from ESQL using BLOB data |
|
|
Novice
Joined: 06 Jun 2008 Posts: 13
|
Hi,
My java function is this
package com.bnsf.mech.da.cmrs.appservice;
public class ComponentResolverAPI {
public static byte[] improveTrainMatch(byte[] inputMsgBytes) {
return inputMsgBytes;
}
}
I am calling it using esql like this
DECLARE inCCSID, inEncoding INT;
SET inCCSID = CAST(InputRoot.Properties.CodedCharSetId AS INT);
SET inEncoding = CAST(InputRoot.Properties.Encoding AS INT);
DECLARE messageOutBlob BLOB;
DECLARE messageBlob BLOB ;
SET messageBlob = ASBITSTREAM(InputRoot.JSON.Data);
SET messageOutBlob = improveTrainMatch(messageBlob);
CREATE LASTCHILD OF OutputRoot DOMAIN('JSON')
PARSE(messageOutBlob ENCODING inEncoding CCSID inCCSID FORMAT 'JSON' OPTIONS RootBitStream) ;
CREATE FUNCTION improveTrainMatch( IN messageBlobIn BLOB)
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "com.bnsf.mech.da.cmrs.appservice.ComponentResolverAPI.improveTrainMatch";
Issue is I can see the BLOB getting created from JSON when I use ASBITSTREAM but when I enter the java function, value is blank.
Any leads would be appreciated. |
|
Back to top |
|
 |
Esa |
Posted: Wed Jun 11, 2014 12:25 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
I cannot check this because the Knowledge Centers are not working at the moment, but shouldn't a BLOB parameters be handled as byte[][] in java?
Search this forum. |
|
Back to top |
|
 |
McueMart |
Posted: Wed Jun 11, 2014 1:08 am Post subject: |
|
|
 Chevalier
Joined: 29 Nov 2011 Posts: 490 Location: UK...somewhere
|
Take a user trace too see if it sheds any light on the issue.
@Esa - I would have expected a 'method not found exception' if it was related to the method signature mismatch. |
|
Back to top |
|
 |
ghoshly |
Posted: Fri Jun 13, 2014 3:00 am Post subject: ESQL / Java comparison |
|
|
Partisan
Joined: 10 Jan 2008 Posts: 333
|
|
Back to top |
|
 |
Esa |
Posted: Fri Jun 13, 2014 3:12 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Yes.
The problem with the table -- when it comes to the OP's problem -- is that it doesn't tell if the the corresponding RETURNS datatatype for BLOB is byte[] or byte[][]... But that should be quite easy to test.
@vanshul: have you run user trace? |
|
Back to top |
|
 |
|