3 Replies Latest reply: Jan 21, 2011 6:15 AM by Anuj Dwivedi--Oracle RSS

    ALSB / OSB Java callout to gunzip

    832932
      We have an input file which is in a gz format, which we need to gunzip before passing onto our business service.

      We're writing a simple Java callout component to do this - taking an input stream and returning an output stream.

      What variable should I pass into my input stream from the callout in the proxy service message flow?

      I've tried $body and $input, but neither of these work.

      Thanks in advance

      Phil Riley
        • 1. Re: ALSB / OSB Java callout to gunzip
          Anuj Dwivedi--Oracle
          Use reporting/alert/log action to check that which variable ($body or $attachments) contains the content of gunzipped file. You may refer below link to know more about context variables in OSB -

          http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html#wp1103311

          Regards,
          Anuj
          • 2. Re: ALSB / OSB Java callout to gunzip
            832932
            Have tried logging to output, and this is what I get:

            $attachments[0]/ctx:attachment/ctx:body - empty

            $body
            <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <con:binary-content ref="cid:2a96c6b3:12da3c4b844:-7f3c" xmlns:con="http://www.bea.com/wli/sb/context"/>
            </soapenv:Body>

            $inbound
            <con:endpoint name="ProxyService$FredhopperExtract$ProxyServices$Test GZip" xmlns:con="http://www.bea.com/wli/sb/context">
            <con:service/>
            <con:transport>
            <con:uri>file:////apps/bea/dp_tmp</con:uri>
            <con:mode>request</con:mode>
            <con:qualityOfService>best-effort</con:qualityOfService>
            <con:request xsi:type="file:FileRequestMetaData" xmlns:file="http://www.bea.com/wli/sb/transports/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <tran:headers xsi:type="file:FileRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
            <file:fileName>/apps/bea/dp_tmp/test.txt.gz</file:fileName>
            </tran:headers>
            <tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
            <file:isFilePath>false</file:isFilePath>
            </con:request>
            </con:transport>
            <con:security>
            <con:transportClient>
            <con:username>&lt;anonymous></con:username>
            </con:transportClient>
            </con:security>
            </con:endpoint>

            None of these actually have the contents of the message - the $body is the closest which tells me that it is binary and has a ref.
            • 3. Re: ALSB / OSB Java callout to gunzip
              Anuj Dwivedi--Oracle
              $body
              <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
              <con:binary-content ref="cid:2a96c6b3:12da3c4b844:-7f3c" xmlns:con="http://www.bea.com/wli/sb/context"/>
              </soapenv:Body>


              So, it is your body ($body) variable which holds the binary file data. For passing it's content to java callout, you may refer -

              Re: Sending the binary-content to a byte[] argument in a Java Callout
              how to read byte[] in OSB

              Let us know if you still face any issue.

              Regards,
              Anuj