Monday, May 19, 2014

OSB, read file content as binary response from HTTP

The trick is:

  • Create a "Messaging Service" Business Service
  • Request type = None
  • Response type = Binary
  • HTTP method = GET

the GET method becomes available only when you choose "request type = None", otherwise you have only POST, PUT and DELETE.

This will return a binary-content response variable that you can process as a Java byte[].

Service Callout will not work with such a BS, because it's Request Type = None. If you try doing it, you get "A callout cannot invoke a one-way operation". Try rather Route.

Forcing a GET HTTP Method to a BS with "Request Type = String", you get this error message:

"[WliSbTransports:381333]HTTP method "GET" is only allowed for Service Type any xml or messaging type with none as the request type."

If you get NullPointerException, try applying Patch 12362492 - patching /opt/oracle/fmw11_1_1_5/osb/lib/sb-transports-main.jar - it worked for us.

1 comment:

Luthra.Ankit said...

how to assign binary content to a variable ?