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

asked on

Posting SOAP from Oracle

Hello,

I'm wondering if someone has some experience with sending SOAP APIs from Oracle. What I need is
1. Take data from oracle table
2. compose an xml message using selected data
3. post this message to a host
4. get a response back

I've been reading about oracle's UTL_HTTP . Is this something I can use to achieve what I want ?
Avatar of Mat Smith
Mat Smith

ASKER

a sample code would be handy
Avatar of MarkusId
Hi,

Yes, you can use UTL_HTTP for this. Just search the terms "soap utl_http" with your preferred search engine and you will find results like, e.g. https://wiki.scn.sap.com/wiki/display/XI/Triggering+webservice+from+Oracle+Database+with+UTL_HTTP+supplied+package.

Basically, it's about opening the connection (utl_http.begin_request), setting the right headers (utl_http.sending the soap xml (utl_http.set_header) , writing the xml to the webservice (utl_http.write_text) and finally receiving the result (utl_http.get_response). Especially for the sending and receiving there are several flavours of the procedures and functions (writing plain text or writing raw, using a procedure or a function receiving the http-response-codes, receiving a VARCHAR2 or RAW, in one chunk or several chunks). Just check the utl_http-documentation (https://docs.oracle.com/database/121/ARPLS/u_http.htm#ARPLS070 for 12.1).

Be aware that, if you use https you also might need to implement the oracle wallet and include the certificates in the wallet (including the site certificate up to 11.0.4, only the root and intermediate certificates in 12.1 upwards)

I think, the above link and the docs should be a goot point to get you started on this.

Best wishes
Markus
Thanks Markus.

I've managed to get it working using the example for the link you had posted. I was missing 'Content-Type' header in my code.

The next part of my development is to create a webservices server, to allow consuming of  APIs.

In this topic https://www.experts-exchange.com/questions/21326948/Make-a-SOAP-Call-using-an-Oracle-Stored-Procedure.html
there is a sample code and instruction how it can be achieved using jdev, which is good. However, this post is from 2005 and it worries me a bit. Nowadays there might be a better way of doing it.
What's your view on this, please ?

Regards,

Mat
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.