HTTP POST request with raw body to ORDS PL/SQL Gateway?

2.6k Views Asked by At

I am using Oracle Database 12.2 and ORDS 18.3. Is it possible to make an HTTP POST request with a raw body (no parameters using application/x-www-form-urlencoded or multipart/form-data) to ORDS, knowing that ORDS is used only for its PL/SQL Gateway part, not the REST Data Services part.

In this scenario, ORDS in standalone mode (with Jetty) is the HTTP server. The HTTP client that makes the request is some external program (Postman, Java, ...).

The idea is to send JSON data but it could be binary data like an image or something else.

It looks like the PL/SQL Gateway is "only" able to invoke procedures using parameters (or no parameter at all but also of course no body). I am able to make a request with a dummy parameter in multipart form and somehow simulate what I want (tested with VARCHAR2, not CLOB nor BLOB) but I wanted to know if the possibility exists.

2

There are 2 best solutions below

0
On BEST ANSWER

To answer my own question, it is not possible. We have to use a parameter and the MIME type application/x-www-form-urlencoded (or multipart/form-data).

1
On

There are a couple ORDS-specific bind variables (implicit parameters) that you can use.

  • :body will return a BLOB. This can be used for anything, including images
  • :body_text will return a CLOB. This is useful for text bodies such as JSON, XML, or the other MIME types you indicated (application/x-www-form-urlencoded or multipart/form-data)

NOTE: You can only dereference the :body or :body_text parameter once in your PL/SQL block (as indicated by this documentation), so you may need to assign it to a local variable before using it.