XML in Stored Procedure

I'm using a 10g
I have this XML.
<item>
<name>Book</name>
<price>12</price>
<itemno>230</itemno>
<qty>57</qty>
<detail>Oracle book</detail>
<company>Oracle</company>
</item>
I want this result.(price, itemno & company)
<item>
<price>12</price>
<itemno>230</itemno>
<company>Oracle</company>
</item>
Would you please help me how to get this in stored procedure?
Thank you.

Or
SQL>  SELECT XMLELEMENT("item", d.xml.EXTRACT ('item/price | item/itemno | item/company')) new_xml
  FROM (SELECT XMLTYPE
                  ('<item>
<name>Book</name>
<price>12</price>
<itemno>230</itemno>
<qty>57</qty>
<detail>Oracle book</detail>
<company>Oracle</company>
</item>') xml  FROM DUAL) d
NEW_XML                                                                                
<item><price>12</price>                                                                
<itemno>230</itemno>                                                                   
<company>Oracle</company>                                                              
</item>                                                                                
                                                                                                                       

Similar Messages

  • Database updation using XML and stored Procedure?

    Hello,
    I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
    If yes then which is more efficient and takes less time.
    1.Updation using xml files only
    2.Updation using xml files with stored procedure.
    3.Stored procedure alone.
    If direct xml and stored procedure communication is possible.then please write how.
    Thanks in advance for any help.

    Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
    package package1;
    import org.w3c.dom.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class Class1 extends Object {
    public static void main( String[] arg ) throws Exception {
    Connection conn = getConnection();
    CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
    ocs.registerOutParameter(1,OracleTypes.CURSOR);
    ocs.execute();
    ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
    OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
    System.out.println(oxq.getXMLString());
    oxq.close();
    rs.close();
    ocs.close();
    conn.close();
    public static Connection getConnection() throws Exception {
    String username = "scott";
    String password = "tiger";
    String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
    String driverClass = "oracle.jdbc.driver.OracleDriver";
    Driver d = (Driver)Class.forName(driverClass).newInstance();
    return DriverManager.getConnection(dburl,username,password);
    null

  • Parsing xml in stored procedure

    I need to pass an XML file as an input parameter to a stored procedure. The procedure will read the XML file and insert the data into a table.

    Plenty of ways of doing it... all described in the FAQ on the XML DB Forum...
    XML DB FAQ

  • XML and Stored Procedures

    Hi,
    Is it possible to pass information to and from an Oracle stored procedure using a XML page? If so could you please point me to examples and/or white pages?
    Thanks!
    Tess

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Lillian Goodwin ([email protected]):
    Hi,
    Is it possible to pass information to and from an Oracle stored procedure using a XML page? If so could you please point me to examples and/or white pages?
    Thanks!
    Tess<HR></BLOCKQUOTE>
    Look at DB Prism, it works like Oracle Web Server but is based on servlet technology.
    With DB Prism you could make an stored procedure in PLSQL or Java and receive the XML values directly using the HTTP protocols.
    DB Prism is at Plenix Web Site
    This week DB Prism 1.1.0-dev will be ready for downloading including full compatibilty with OWS/OAS/IAS/Web DB toolkits.
    Best regards, Marcelo
    null

  • XML from stored procedure

    I am calling a oracle stored function which returns REF CURSOR.. I am using XDP to convert the result set into XML.. But the result coming from my java program is like below..
    I don't want to have those bind variables (:B1, :B2 etc) in there, how can I get the record variable names instead of bind variables.. Thanks for your help..
    stmt.execute(); // Execute the statement.
    ResultSet rset = (ResultSet)stmt.getObject(1); // Get the ResultSet
    OracleXMLQuery qry = new OracleXMLQuery(_conn,rset); // prepare Query class
    qry.setRaiseNoRowsException(true);
    qry.setRaiseException(true);
    qry.keepCursorState(true); // set options (keep the cursor alive..
    while ((str = qry.getXMLString())!= null)
    System.out.println(str);
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <:B1>36874538</:B1>
    <:B2>SB</:B2>
    <:B3>SBMB</:B3>
    <:B4>LTL</:B4>
    <:B5>Y649</:B5>
    <:B6>I</:B6>
    <:B8>IR</:B8>
    <:B9>CO</:B9>
    <:B10>3033693323</:B10>
    <:B12>0</:B12>
    </ROW>
    </ROWSET>

    Would you post the sample SQL Query or send test case to me at: [email protected]

  • XML - Stored Procedure

    Hi ,
    How to parse the xml to Stored procedure?
    Regards
    Thamilselvan J

    How to parse the xml using Stored procedure?Please find the sample code below.(invoke a webservice,get the soap response XML and subsequently parse the XML)
    DECLARE
    http_req utl_http.req;
    http_resp utl_http.resp;
    ls_out_resp varchar2(32767);
    ls_out_xml xmltype;
    ls_out varchar2(200);
    BEGIN
    -- Invoke the webservice\URL
    http_req := utl_http.begin_request("your webservice url", 'GET' ,'HTTP/1.1');
    -- Set the Content header
    utl_http.set_header(http_req,'Content-Type','text/xml;charset=UTF-8');
    -- Get the HTTP response
    http_resp := utl_http.get_response(http_req);utl_http.read_text(http_resp, ls_out_resp);
    - - Parse the XML response
    ls_out_xml := xmltype(ls_out_resp);
    ls_out:=ls_out_xml.extract('/GDSXYZ/RESULT/ZZZ/text()').getStringVal();
    utl_http.end_response(http_resp);
    The lines in bold are the ones to parse the XML.
    Good luck!!!
    Bhagat

  • Stored Procedure call to Oracle - issue

    hi ,
    I am trying to call a receiver JDBC adapter to call an oracle stored procedure -
    I got this error ->
    java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call  - which I understand is related to mismatch btw the XML and Stored procedure
    I checked the XMl and it matches the stored procedure call.  I have two specific questions -
    1) I have used SAP Note 801367 to have  a look at the SQl command sent to the db.. However I do not see the stored procedure in the Audit logs...Does this feature work for Stored procedures too?
    2) Can you look at the XML sent to the JDBC adapter...I saw something wierd... even though I had declared the isOutput attribute first and then attribute type... when I  loaded the MT into the mapping the order changed...Does than matter?
      <customer_id isInput="true" type="VARCHAR">5000123</customer_id>
      <product_id isInput="true" type="VARCHAR">0041003</product_id>
      <serial_number isInput="true" type="VARCHAR">1</serial_number>
      <effective_date isInput="true" type="VARCHAR">2010-03-16</effective_date>
      <quantity isInput="true" type="NUMERIC">1.000</quantity>
      <currency_code isInput="true" type="VARCHAR">USD</currency_code>
      <dist_channel_id isInput="true" type="VARCHAR">11</dist_channel_id>
      <division_id isInput="true" type="VARCHAR">04</division_id>
      <org_unit_id isInput="true" type="VARCHAR">1005</org_unit_id>
      <config_name isInput="true" type="VARCHAR" />
      <resolved_price type="NUMERIC" isOutput="true" />
      <resolved_currency type="VARCHAR" isOutput="true" />
      <contract_id type="VARCHAR" isOutput="true" />
      <contract_desc type="VARCHAR" isOutput="true" />
      <contract_owner_id type="VARCHAR" isOutput="true" />
      <payment_terms type="VARCHAR" isOutput="true" />
      <product_group_id type="VARCHAR" isOutput="true" />
      <commitment_id type="VARCHAR" isOutput="true" />
      <tier_index type="VARCHAR" isOutput="true" />
      <shipping_flag type="VARCHAR" isOutput="true" />
      <result_code type="VARCHAR" isOutput="true" />
      <exec_time type="NUMERIC" isOutput="true" />
    java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call

    Arvind,
    Just to be sure: are all inputs to yourstored procedure of type varchar, or are there maybe inputs with different types?
    A mismatch between the type specified in the XML and the expected inputs of the SP can also cause this error.
    Regards,
    Koen

  • XML CLOB out from a stored procedure

    I'm using Oracle 8.1.7 and OO4O(Oracle Objects for OLE)
    8.1.7.0.1
    I'm generating an XML string in a CLOB using the XSU in a stored
    procedure.
    I'm then trying to pass the CLOB as an out parameter for that
    procedure to an
    ASP page using OO4O. I get the following error on the line
    where I call the ExecuteSql
    method of the OO4O Database object:
    Error Type:
    Oracle Automation (0x800A01B8)
    OIP-04796: Error in creating object instance
    If anyone can give me a a solution to this or a better way to
    do it I would much appreciate it. I've tried using a function
    as well.
    It does work if the CLOB is pulled from a database field, so I
    think
    the problem lies in the CLOB coming from the getXML method.
    Since I'm
    creating and XML datagram from relational tables, it doesn't
    make much
    sense to save the generated XML to a CLOB field and then load it
    right
    back to pass to the web page.
    Thanks in advance...
    Here's my code for the stored procedure:
    Procedure SP_INI_XML
    (result OUT CLOB)
    IS
    queryCtx SYS.DBMS_XMLQuery.ctxType;
    begin
    queryCtx := SYS.DBMS_XMLQuery.newContext(... SQL
    statement ...);
    SYS.DBMS_XMLQuery.setRowTag(queryCtx,'INI');
    SYS.DBMS_XMLQuery.setRowsetTag(queryCtx,'ROOT');
    SYS.DBMS_XMLQuery.setXSLT(queryCtx, 'http://site/file.xsl');
    result := SYS.DBMS_XMLQuery.getXML(queryCtx);
    SYS.DBMS_XMLQuery.closeContext(queryCtx);
    end;
    Here's my code from the ASP page:
    Set ses = Server.CreateObject("OracleInProcServer.XOraSession")
    Set con = ses.OpenDatabase(DBServer,ConStr,0)
    Const ORATYPE_CLOB = 112
    con.Parameters.Add "str",Null,2,ORATYPE_CLOB
    con.ExecuteSql("begin SP_INI_XML(:str);end;")

    Ah yes I see. Sorry I misunderstood what you were suggesting. I'm currently working on a test script that uses an approach similar to the one you mentioned, but I'm having trouble resolving foreign key relationships with test data.
    I've no access to the tables or anything so it's proving to be a time consuming task!!
    Is it required that all fields are given a value, even if they have a "DEFAULT" defined for them within the procedure. At the moment I'm using a rather cumbersome approach to this:
    i.e.
    With cmmAddRequest
        .ActiveConnection = strConnect
        .CommandType = adCmdText
        .CommandText = strSQL
        .Parameters(0).Direction = adParamInput
        .Parameters(1).Direction = adParamInput
        .Parameters(2).Direction = adParamInput
        .Parameters(3).Direction = adParamOutput
        .Parameters(4).Direction = adParamOutput
        .Parameters(5).Direction = adParamOutput
        .Parameters(0).Value = "COMP"
        .Parameters(1).Value = "FRML"
        .Parameters(2).Value = "1"
        .Execute
        WScript.Echo(.Parameters(5).Value)
    End With

  • How to get XML output from a stored procedure

    I have a very simple question:
    I would like to write a stored procedure (SP) that will return results in XML format (as a string). My tables in database are not of XML TYPE. But I need XML output.
    ie, SP will run like a typical SP but the only difference will be its output in XML.
    1) is it possible?
    2) if possible, how?
    Please, help
    Omer Koksal

    Thank you Peter, it was a great problem for me !
    Omer Koksal

  • Creating XML report using PL/SQL Stored Procedure

    Hi Friends,
    I am working on an xml report with the xml source as PL/SQL Stored Procedure.
    I am referring the exercise shown in the following link to understand the process:
       http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html
    In the example shown in the above link I could not understand the following:
    1) In the following procedure, the out parameter 'retcode' is not used at all.
       What is the importance of this parameter.
        PROCEDURE REPORT (errbuf  OUT VARCHAR2, retcode  OUT VARCHAR2, p_product_id   IN     NUMBER)
    2)  After the xml data is prepared and put to 'l_result' Clob variable, the following
        Loop is executed. I am not able to appreciate why the following loop is required.
         LOOP
             EXIT WHEN l_length = l_retrieved;
             IF (l_length - l_retrieved) < 32000
             THEN
                SELECT SUBSTR (l_result, l_retrieved + 1) INTO l_xmlstr FROM DUAL;
                l_retrieved := l_length;
                fnd_file.put_line (fnd_file.output, l_xmlstr);
             ELSE
                SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)
                  INTO l_xmlstr
                  FROM DUAL;
                l_retrieved := l_retrieved + l_offset;
                fnd_file.put_line (fnd_file.output, l_xmlstr);
             END IF;
         END LOOP;
    3) In the example it is not explained how the concurrent program gets the xml data?
       I assume it is written to a file using the following line of code:
        fnd_file.put_line (fnd_file.output, l_xmlstr);
       I would appreciate if anyone can throw some light into my above queries so that I can understand the process clearly.
    Thanks & Regards
    Hawker

    Hi 32000 in the code is a 'safe' size smaller than the max available 32767, the loops purpose is to move through the entire thing in chunks that will be manageable in the limits of the data type.
    Btw; if you are in Oracle e-business suite then you can also use Oracle reports very simply to create XML output.
    If you have reports developer all you need to do is put raw sql (without any 'artifice' to create XML) in the report SQL and then set the reports output to XML in the program definition in Oracle e-business.
    best regards,
    Robert.

  • How to generate XML Publisher report from PLSQL Stored Procedure in APPS

    Hi,
    I have concurrent program of type PLSQL Stored procedure.I need to generate XML Publisher report from the same.I have changed the output of the concurrent program as "XML" but when I tried running it,the XML tags are not generated.Due to this I am unable to create the template.Its a urgent issue.
    Please help me out .
    Thanks in advance.
    Kaveri

    Hi Kaveri
    Sadly there is nothing magic about that output field. The only program type that you can flip it to XML and then magically get XML is for Oracle Reports. For plsql you will need to recode the plsql to generate XML rather than text that you have now.
    You have some options, best option first:
    1. Move the sql to a data template - check the user guide and blog for help or
    2. Use SQL XML or XMLGEN (not great for large datasets) or
    3. Use dbms_output.put_line and write the XML file manually - not performant at all
    Regards, Tim

  • How can I transfer a XML file content to a MS SQL database by stored procedure using LabWindows/CVI SQL Toolkit?

    Hi,
    I have a problem to transfer a XML file content to a MS SQL database by a given/fixed stored procedure. I'm able to transfer the content of the file by using following method ...
    hstmt = DBPrepareSQL (hdbc, EXEC usp_InsertReport '<Report> ..... </Report>');
    resCode = DBExecutePreparedSQL (hstmt);
    resCode = DBClosePreparedSQL (hstmt);
    ... but in this case I'm not able to fetch the return value of the stored procedure! 
    I have tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL) but I miss a datatype for xml?!?
    Any idea how to solve my problem?
    KR Cake  
    Solved!
    Go to Solution.

    After some additional trials I found a solution by calling the stored procedure in this way
    DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
    DBPrepareSQL (hdbc, "usp_InsertReport");
    DBCreateParamInt (hstmt, "", DB_PARAM_RETURN_VALUE, -1);
    DBCreateParamChar (hstmt, "XMLCONTENT", DB_PARAM_INPUT, sz_Buffer, (int) strlen(sz_Buffer) + 1 );
    DBExecutePreparedSQL (hstmt);
    DBClosePreparedSQL (hstmt);
    DBGetParamInt (hstmt, 1, &s32_TestId);
    where sz_Buffer is my xml file content and s32_TestID the return value of the stored procdure (usp_InsertReport(@XMLCONTENT XML))
    Now I face the problem, that DBCreateParamChar limits the buffer size to 8000 Bytes.
    Any idea to by-pass this shortage??

  • Help Needed in Xml Stored Procedure

    Hi , i am trying to write one sp which takes xml document as a parameter. I want to update/Insert the data in the xml based on some conditions. So i put the data from xml to a global TEMPORARY table. The i process this data and will update /Insert the data based on the output.
    Right now i am unable to create global TEMPORARY table my stored procedure .When i compile the stored procedure , its showing the following error
    Compilation errors for PROCEDURE SYSTEM.TESTXML
    Error: PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe
    Line: 8
    Text: CREATE GLOBAL TEMPORARY TABLE temp
    I am attaching my sp below
    create or replace procedure testxml
    ( xmlDoc IN clob )
    is
    updCtx DBMS_XMLStore.ctxType;
    rows NUMBER;
    begin
    CREATE GLOBAL TEMPORARY TABLE temp
    ( cdcalendar NUMBER,
    cdperiod NUMBER,
    cdsubperiod NUMBER,
    cdglperiod NUMBER,
    dtstartsubperiod date,
    dtendsubperiod date
    ) ON COMMIT PRESERVE ROWS;
    updCtx := DBMS_XMLStore.newContext(temp)
    rows := DBMS_XMLStore.insertXML(updCtx,xmlDoc);
    DBMS_XMLStore.closeContext(updCtx);
    if Not exists
    (Select Distinct cd_calendar from Calendar_Period
    Where cd_calendar = select Distinct cdcalendar from temp )
    Then
    Insert into calendar_period
    cd_calendar,
    cd_period,
    cd_subperiod,
    cd_gl_period,
    dt_start_subperiod,
    dt_end_subperiod
    select cdcalendar,
    cdperiod,
    cdsubperiod,
    cdglperiod,
    dtstartsubperiod,
    dtendsubperiod
    from temp ;
    Else
    Update calendar_period
    Set cdp.cd_calendar = temp.cdcalendar ,
    cdp.cd_period = temp.cdperiod,
    cdp.cd_subperiod = temp.cdsubperiod ,
    cdp.cd_gl_period = temp.cdglperiod,
    cdp.dt_start_subperiod = temp.dtstartsubperiod ,
    cdp.dt_end_subperiod = temp.dtendsubperiod
    From
    calendar_period cdp Inner Join temp
    On
    cdp.cd_calendar = temp.cdcalendar
    cdp.cd_subperiod = temp.cdsubperiod
    cdp.cd_period = temp.cdperiod ;
    End if
    end testxml;
    Kindly guide me !!!!

    Hi,
    "CREATE GLOBAL TEMPORARY TABLE" is not a PL/SQL sommand; it is a SQL command. That explain the error message you're getting.
    Normally, tables (including Global Temporary Tables) are created once for all, without using PL/SQL. After they are created, you can write PL/SQL code to populate and use them. This job doies not seem to be an exception.
    In the rare event that you do need to create a table in PL/SQL, use EXECUTE IMMEDIATE, which can do any SQL command from withiin PL/SQL.
    EXECUTE IMMEDIATE is documented in the PL/SQL manual:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/dynamic.htm#sthref857

  • Help on writing pl/sql stored procedure to accept input in xml format

    Hi All,
    I need to write a pl.sql stored procedure which would be getting the input as an xml.
    The requirement is that xml data recieved in below fashion needs to be inserted to 3 different tables.
    The tags under the root node directly needs to be inserted into Table1
    The tags under the first element of the root node needs to be inserted into Table2
    Can anybody help me on how to write a stored procedure which could take up the below xml as input and insert the data received into 3 different tables.
    Any sample code.pointers to achieve this could be of great help.
    The structure of the xml would be as follows:
    <AssemblyProduct>
    <AssemblyHeader>
    <Name></Name>
    <AssemblyId></AssemblyId>
    <ListOfHCSIFFs><HCSIFFHeader><Id></Id> </HCSIFFHeader> </ListOfHCSIFFs>
    <ListOfHCSIFFs><HCSIFFHeader><Id></Id> </HCSIFFHeader> </ListOfHCSIFFs>
    <ListOfHCSIFFs><HCSIFFHeader><Id></Id> </HCSIFFHeader> </ListOfHCSIFFs>
    </AssemblyHeader>
    <AssemblyHeader>
    <Name></Name>
    <AssemblyId></AssemblyId>
    </AssemblyHeader>
    <AssemblyHeader></AssemblyHeader>
    <ApplicationId></ApplicationId>
    <ApplicationName></ApplicationName>
    <ApplicationValidFrom></ApplicationValidFrom>
    <ApplicationValidTo></ApplicationValidTo>
    </AssemblyProduct>

    Well you could write your procedure to accept a parameter of XMLTYPE datatype and then use that value in a query inside the procedure to break the data up as required using something like XMLTABLE e.g.
    -- Nested repeating groups example:
    WITH t as (select XMLTYPE('
    <RECSET>
      <REC>
        <COUNTRY>1</COUNTRY>
        <POINT>1800</POINT>
        <USER_INFO>
          <USER_ID>1</USER_ID>
          <TARGET>28</TARGET>
          <STATE>6</STATE>
          <TASK>12</TASK>
        </USER_INFO>
        <USER_INFO>
          <USER_ID>5</USER_ID>
          <TARGET>19</TARGET>
          <STATE>1</STATE>
          <TASK>90</TASK>
        </USER_INFO>
      </REC>
      <REC>
        <COUNTRY>2</COUNTRY>
        <POINT>2400</POINT>
        <USER_INFO>
          <USER_ID>3</USER_ID>
          <TARGET>14</TARGET>
          <STATE>7</STATE>
          <TASK>5</TASK>
        </USER_INFO>
      </REC>
    </RECSET>') as xml from dual)
    -- END OF TEST DATA
    select x.country, x.point, y.user_id, y.target, y.state, y.task
    from t
        ,XMLTABLE('/RECSET/REC'
                  PASSING t.xml
                  COLUMNS country NUMBER PATH '/REC/COUNTRY'
                         ,point   NUMBER PATH '/REC/POINT'
                         ,user_info XMLTYPE PATH '/REC/*'
                 ) x
        ,XMLTABLE('/USER_INFO'
                  PASSING x.user_info
                  COLUMNS user_id NUMBER PATH '/USER_INFO/USER_ID'
                         ,target  NUMBER PATH '/USER_INFO/TARGET'
                         ,state   NUMBER PATH '/USER_INFO/STATE'
                         ,task    NUMBER PATH '/USER_INFO/TASK'
                 ) y
       COUNTRY      POINT    USER_ID     TARGET      STATE       TASK
             1       1800          1         28          6         12
             1       1800          5         19          1         90
             2       2400          3         14          7          5And then you can extract and insert whatever parts you want into whatever tables as part of the procedure.

  • XML parsing in Stored procedure

    Hi friends,
    PLease help to resove my issue mentioned below.
    I am tring to parse one large xml whic i am getting from calling a webservice.I am reading line by line from the request and storing into a clob variable.
    I convert it to xml type for some manipulation after that When i am trying to convert it back to Clob by using getClobVal() data is getting truncated.
    Please help how can i resolve this issue

    hI,
    i AM TRYING TO CALL A WEBSERVICE FROM MY ORACLE STORED PROCEDURE .tHE REQUEST IS LIKE
    soap_request:= '<soapenv:Envelope xmlns:soapenv="" xmlns:web="">
    <soapenv:Header/>
    <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="">
    <web:getEmpInfo>
    <Param>
    <WST/>
    <EmpId>'I am giving certain value here'</EmpId>
    <requestId/>
    </Param>
    </web:getEmpInfo>
    </soapenv:Body>
    </soapenv:Envelope>';
    http_req:= utl_http.begin_request
    ( 'Webservice URL'
    , 'POST'
    , 'HTTP/1.1'
    utl_http.set_header(http_req, 'Content-Type', 'text/xml'); -- since we are dealing with plain text in XML documents
    utl_http.set_header(http_req, 'Content-Length', length(soap_request));
    utl_http.set_header(http_req, 'SOAPAction', ''); -- required to specify this is a SOAP communication
    utl_http.write_text(http_req, soap_request);
    http_resp:= utl_http.get_response(http_req);
    utl_http.read_text(http_resp, soap_respond);// soap_request CLOB;
    // soap_respond CLOB;
    utl_http.end_response(http_resp);
    resp:= XMLType.createXML(soap_respond);// resp XMLType;
    My REsponse from webservice is in the following format
    <soapenv:Body><p663:getEmpInfoResponse xmlns:p663=""><getEmpInfoReturn><errorLevel>1</errorLevel>
    <returnMessage>.</returnMessage>
    <returnSet>My result is in here</returnSet>
    After that i am
    EXTRACTING the resp for getting result set
    Then to get canonical XML format(I mean with out any < or> symbols i am using
    respStr := resp.getClobVall();
    respStr := DBMS_XMLGEN.CONVERT(respStr,1);
    resp:= XMLType.createXML(respStr);
    parser := xmlparser.newParser;
    xmlparser.parseBuffer(parser, respStr);
    doc := xmlparser.getDocument(parser);
    xmlparser.freeParser(parser);
    The data is getting truncated when resp.getClobVall() is calling
    . So end tag missing error is coming while parsing.
    I am using 9i version oracle. XML that is returning from webservice is more that 80K
    Edited by: user9138090 on Feb 12, 2010 10:55 AM
    Edited by: user9138090 on Feb 12, 2010 11:16 AM
    Edited by: user9138090 on Feb 12, 2010 12:02 PM
    Edited by: user9138090 on Feb 12, 2010 12:03 PM

Maybe you are looking for