60.27 PARSE_XML_CLOB Function
This function parses the response from a Web service returned as an XMLTYPE and returns the value requested as a CLOB.
Syntax
APEX_WEB_SERVICE.PARSE_XML_CLOB (
p_xml IN XMLTYPE,
p_xpath IN VARCHAR2,
p_ns IN VARCHAR2 DEFAULT NULL )
RETURN CLOB;
Parameters
Parameter | Description |
---|---|
p_xml |
The XML document as an XMLTYPE to parse. |
p_xpath |
The XPath expression to the desired node. |
p_ns |
The namespace to the desired node. |
Example
The following example uses the make_request
function to call a Web service and stores the results in a local XMLTYPE
variable. The parse_xml_clob
function then fetches a specific node of the XML document that is stored in the XMLTYPE
and stores it in a locally-declared CLOB
variable.
DECLARE
l_envelope CLOB;
l_xml XMLTYPE;
l_movie CLOB;
BEGIN
l_envelope := ' <?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://www.ignyte.com/whatsshowing"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<tns:GetTheatersAndMovies>
<tns:zipCode>43221</tns:zipCode>
<tns:radius>5</tns:radius>
</tns:GetTheatersAndMovies>
</soap:Body>
</soap:Envelope>';
l_xml := apex_web_service.make_request(
p_url => ' http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx',
p_action => ' http://www.ignyte.com/whatsshowing/GetTheatersAndMovies',
p_envelope => l_envelope );
l_movie := apex_web_service.parse_xml_clob(
p_xml => l_xml,
p_xpath => ' //GetTheatersAndMoviesResponse/GetTheatersAndMoviesResult/Theater/Movies/Movie/Name[1]',
p_ns => ' xmlns="http://www.ignyte.com/whatsshowing"' );
END;
Parent topic: APEX_WEB_SERVICE