Click here to Skip to main content
15,887,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am calling a SOAP webService from oracle which is returning xml response

I am trying to catch the boolean value using xmlTable as here but my code is returning parsing error which i cannot catch. Any hint? Below is my code:

FUNCTION XMLTEST (P_XML VARCHAR2) RETURN VARCHAR2 AS
V_FLAG VARCHAR2(4000);

BEGIN
SELECT P.boolean
INTO V_FLAG
FROM xmltable('/boolean'
passing xmltype(P_XML)
columns boolean VARCHAR2(30) PATH 'text()') P;
RETURN V_FLAG;
END XMLTEST;


please check this link to preview the xml

What I have tried:

This code below is working fine and returning action value 'like' for this structure

SELECT P.action
INTO V_FLAG
FROM xmltable('/profile/subject/action' passing xmltype(P_XML)
columns subject VARCHAR2(30) PATH 'text()',
action VARCHAR2(30) PATH 'text()',
object XMLTYPE PATH 'object') P;

RETURN V_FLAG;
END XMLTEST;
Posted
Updated 21-Sep-16 2:24am
v5

1 solution

Solved, the problem was with xmlns=".."

FUNCTION XMLTEST (P_XML VARCHAR2) RETURN VARCHAR2 AS
V_FLAG VARCHAR2(4000);
V_XML1 VARCHAR2(4000);
V_XML2 VARCHAR2(4000);
V_XML VARCHAR2(4000);
BEGIN
V_XML1 := SUBSTR(P_XML,0,INSTR(P_XML,'xmlns')-1)||'>';
V_XML2 := SUBSTR(P_XML,INSTR(P_XML,'/Methods">')+10);
V_XML := V_XML1||V_XML2;

SELECT P.boolean
INTO V_FLAG
FROM xmltable('/boolean' passing xmltype(V_XML)
columns boolean VARCHAR2(30) PATH 'text()') P;

RETURN V_FLAG;

END XMLTEST;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900