ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Doubt on getting byte array from Java program to ESQL

Post new topic  Reply to topic
 Doubt on getting byte array from Java program to ESQL « View previous topic :: View next topic » 
Author Message
kash3338
PostPosted: Tue Apr 07, 2009 5:22 am    Post subject: Doubt on getting byte array from Java program to ESQL Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Hi,

I have a scenario where in I want to invoke a Java method from ESQL and that method has byte array as return type. Now i want to get that byte array in my ESQL and process it.

Currently i am using this code to invoke the static java method:

CREATE PROCEDURE MYJAVA()
RETURNS BLOB
LANGUAGE JAVA
EXTERNAL NAME "<my class path>";

I am calling this procedure in ESQL through a CALL statement and storing the return byte array in an local environment variable.

But when i use that BLOB data, actually some data are missing in it. May be i should do some Encoding/Decoding to the return data.

Can anyone please guide me on this?

Regards,
Kashyap.
Back to top
View user's profile Send private message Send e-mail
WMBDEV1
PostPosted: Tue Apr 07, 2009 5:29 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Which bits are missing?

Are you sure they are present when Java returns the array? How do you know? have you printed the data to a file for example?
Back to top
View user's profile Send private message
kash3338
PostPosted: Tue Apr 07, 2009 5:33 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

WMBDEV1 wrote:
Which bits are missing?

Are you sure they are present when Java returns the array? How do you know? have you printed the data to a file for example?


Yes i am sure they are present when java returns because i have written it to a file and i am getting a proper output. But when i create a file through MB with the returned BLOB data, it says some information missing.

Actually i have to create a ".png" file from this byte array data and later convert it to ".jpeg" file. When i try to convert the ".png" to ".jpeg" i get this error.
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Apr 07, 2009 5:54 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Maybe you're doing the wrong thing when writing the file "through WMB".

To confirm if it's the Java->ESQL stage that's "removing data", you can do an additional ESQL->Java stage and call another procedure that will write the BLOB data.

This will tell you for sure whether the BLOB has all of the right data.

Or you can set up a Trace node and have that write the BLOB data.. although whether a trace node will show you the entire contents of a BLOB string depends a bit on what level of WMB you're at - there are some bugs in this area.
Back to top
View user's profile Send private message
p.cradwick
PostPosted: Tue Apr 07, 2009 10:34 am    Post subject: Reply with quote

Acolyte

Joined: 16 May 2001
Posts: 56

Just a thought...It wouldn't be CR/LF that are missing would it? That is what happens if you FTP a picture file as ASCII instead of BINARY. Are you doing anything when you get the data back in ESQL that might make broker think it is a text file, like parsing it to XML??
Back to top
View user's profile Send private message Send e-mail
mqpaul
PostPosted: Wed Apr 08, 2009 5:13 am    Post subject: Just to be clear, you're not expecting Broker to convert? Reply with quote

Acolyte

Joined: 14 Jan 2008
Posts: 66
Location: Hursley, UK

kash3338 wrote:
Actually i have to create a ".png" file from this byte array data and later convert it to ".jpeg" file. When i try to convert the ".png" to ".jpeg" i get this error.
I presume this conversion is outside the broker. I believe the two ways to encode images are wildly different, and what's valid for .png isn't valid for .jpeg.

You could be losing data when passing from Java to ESQL, or from ESQL to file. If there's data encoding going on, you could get all sorts of contact admin problems. Both png and jpeg are unencoded binary data (i.e. not UTF-8/ASCII/ISO 8859-1 characters). But using BLOBs should avoid issues.

How are you writing the file?
_________________
Paul
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 08, 2009 5:30 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I've run into something recently that appears the same way.

I was reading a MIME message using JavaMail, and was getting corruption on a binary attachment by using a BufferedReader on the InputStream.

When I switched to just using the InputStream directly into a ByteArrayOutputStream, I didn't have any trouble putting the result of toByteArray into an MbElement.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Doubt on getting byte array from Java program to ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.