Link to home
Start Free TrialLog in
Avatar of Mat Smith
Mat Smith

asked on

API to call oracle function

Hi Guys,

I wonder if anyone has any experience in calling an oracle procedure/function using APIs ?
I've been reading about JDeveloper, APEX and Oracle App server and I'm a little bit confused with all my findings and the best approach.
What I need is
1. receive a SOAP API call
2. Trigger an oracle function
3. Send a response back

I have already a web server running ( hosted web app - Apache-HttpClient). However, an oracle is on a different box.
Avatar of David Favor
David Favor
Flag of United States of America image

1. receive a SOAP API call

Fairly simple. Likely you've gotten this far.

2. Trigger an oracle function

In your API code, after the SOAP call comes in, you do database connect + perform a database activity, like a SELECT, then format the data into a response packet of data.

3. Send a response back

Then return the response.

Tip: If you're doing many complex SELECTs + returning a simple data structure, might be best (in some cases) to build a caching mechanism to transform incoming API calls into cache lookups, then return your SOAP response with no database I/O (disk trash).

You get some big wins if you have 1000s of API calls each second doing the exact same work.
Avatar of Mat Smith
Mat Smith

ASKER

Thanks, David for getting back to me.

I'm afraid the step no 1, is where I am at the moment. I need to build web services server and wsdl files,  and make sure they are accessible via url, so an API can be received/consumed.

Are you able to describe the best/simples way of doing it ?
Hi Mat,

The easiest way I think to offer webservices currently is using the ORDS (Oracle REST Data Services)-interface. Please find a step-by-step-guide on how to implement it here: https://oracle-base.com/articles/misc/oracle-rest-data-services-ords-create-basic-rest-web-services-using-plsql.

Depending on what tools you are using, the whole implementation could also be done using a GUI like SQLDeveloper (e.g. https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/ords/r30/Install_Administer_ORDS/Install_Administer_ORDS.html
Thanks Marcus, but I need to do it as SOAP, so ORDS is for REST... but indeed it looks very straightforward :)
You just have to dive in + get started.

Tips...

1) Start with Ubuntu Bionic (LTS - Long Term Service version) at machine level + install LXD as only additional package.

2) Only use the SNAP version of LXD, as only this LXD version receives updates.

3) Use PHP as your target language, so you can leverage PHP Opcache, for best speed.

4) Use PHP memoize() for creating simple caching for incoming requests.

Depending on your usage pattern (duplicate API call frequency), using memoize() may greatly reduce SQL I/O.

5) Use https://dev.to/dopitz/implementing-a-soap-api-with-php-a3n as a starting point.

Get your SOAP endpoint + client working, then start adding functionality.

6) Build your test suite first, which will feed SOAP test calls to your SOAP endpoint, which will then return defined responses to your test harness.

This way, you can run your test harness repeatedly (after major/minor code changes) to ensure your endpoint functionality survives your code changes correctly.

7) Develop your SOAP endpoint inside an LXD container, with every endpoint container having it's own public IP.

This will make your life very simple.

You can spin up new instances on other machines to scale up or create dev containers to work on, which are a mirror image of your production containers.

Avoid monolithic SOAP endpoint... meaning your code runs on at the machine/server level.

Run all your code in LXD containers for best experience.
ASKER CERTIFIED SOLUTION
Avatar of Mat Smith
Mat Smith

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial