1 Reply Latest reply on Jun 17, 2010 7:38 AM by 746732

    Sending the binary-content to a byte[] argument in a Java Callout

      I've been looking many posts, documentation and testing a lot of alternatives (MFL, XMLObject, String) and I am unable to get success.
      In my custom transport I provide a ByteArraySource to the ALSB. Then my body looks like that:

      <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <con:binary-content ref="cid:40378b24:129363f96f1:-7f85" xmlns:con="http://www.bea.com/wli/sb/context"/>

      Then, I have to process the binary content to get an XML with a Java Callout. The method signature might be something like this:

      public static String toXML(byte[] data) {

      In a first approach I sent the $body/ctx:binary-content and received in the pojo as a BinaryContentDocument, but I don't know what to do with this.
      If I try to convert the binary-content with an XML->NON-XML MFL conversion I don't know how to retrieve the whole message (without limiters).

      I would also ask if it would be a better solution to return an XMLObject to represent the generated XML or the bus could parse it in a better way.

      Thanks in advance,
        • 1. Re: Sending the binary-content to a byte[] argument in a Java Callout
          The solution was pretty simple. Set the binary data to a variable through an assign instead of trying to get it directly usign XPath in the Java Callout
          $body/* or $body/ctx:binary-content
          assigned to $myBinary.

          Java Callout using $myBinary.

          It works both for ALSB and OSB. I don't know why only works this way, but I can go on.

          Problem solved :)

          Edited by: rromero on 17-jun-2010 0:35 - More info added.