Forum Stats

  • 3,770,698 Users
  • 2,253,155 Discussions
  • 7,875,551 Comments

Discussions

Can I do image format detection based on message content in SOA Suite 12c (or Java)

Jesper!
Jesper! Member Posts: 9 Green Ribbon
edited Nov 5, 2020 1:17PM in SOA Integration

Hi all,

I have a SOA suite 12c composite application featuring a BPEL (BPEL 2.0) that receives an xml payload containing an example element <picture>boaeBuo768vivuiViug9</picture> (but than much much longer). The format in this picture could be anything from JPEG2000, JPEG, to BMP or PNG. Now the target application can not function with JPEG2000, so what I want to do is reroute the image if it turns out to be a JPEG2000 image.

My Question is: How can I detect the image type based on the message content using the means available in SOA Suite 12c (BPEL). Is there something I can do with XSLT, or perhaps a Java embedding?

I can use all the help possible, no wrong answers! :).

Thanks!

Jesper

Answers

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,776 Bronze Crown

    Hi Jesper,

    You should indeed use a Java library as described here: https://blog.idrsolutions.com/2019/08/why-we-wrote-our-own-java-jpeg2000-libraries/ to process those images.

    It's not easy to recognize those images in a simple way. Hower, for the fun of it, you can open such a file like png or gif in Notepad++. For some files you'll recognize that the first few bytes will identify the type of file.

    But Jpeg and jpeg2000 are lossy comporessed files. You may find yourself in using an algorithm in the sense of try to read it using a Jpeg lib. If that succeeds then it's apparently a JPeg file. If not it's something else, maybe Jpeg2000, so try that lib. Some libraries are capable of reading multiple formats. So, those could just tell you what type it is.

    With an Embedded Java or Spring component, you could process that. SOA Suite in itself does not support these files, because they're not structured data.

    Kind regards,

    Martien