A while ago Robert and Pete blogged about Oracle’s UTL_HTTP package. Robert gave an example of how to use this package to request a web page from the Internet into Oracle and Pete mentioned that you could do the opposite, i.e. post data from Oracle to the Internet. Recently I had a requirement to do just that, HTTP post data from the Oracle database to another web server. So, I wrote the following generic procedure util_pkg.http_post. Here it is followed by an example of how to use it (tested on 9.2): (more…)
First, let’s see how you can post XML over HTTP to another page. This is very simple in ColdFusion:
<cfhttp url="url_to_post_to" method="post">
<cfhttpparam
type="XML"
name="XmlDoc"
value="#your_xml#">
</cfhttp>
Now, suppose you are posting the XML to a ColdFusion page. How would you read the XML from the HTTP POST body? Again, this is very simple in ColdFusion:
<cfset docContent = GetHTTPRequestData().content>
<cfset myDOM = XmlParse(docContent)>
and now you can manipulate the XML DOM, stored in myDOM, in any way you like.
<cfhttp> documentation
GetHTTPRequestData documentation
ColdFusion XML documentation