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.
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.
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 ?
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/ar ticles/mis c/oracle-r est-data-s ervices-or ds-create- basic-rest -web-servi ces-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/web folder/tec hnetwork/t utorials/o be/db/ords /r30/Insta ll_Adminis ter_ORDS/I nstall_Adm inister_OR DS.html
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/ar
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/web
ASKER
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/impl ementing-a -soap-api- with-php-a 3n 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.
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/impl
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.