Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Parsing SOAP web service response

Santosh SangaleFeb 7 2018 — edited Mar 2 2018

Hi,

I am using 'ErpIntegrationService' to upload file in UCM server and I am able to successfully upload file (below is the code). But in parse xml response section I am getting error.

Here is the code and error,

declare

        l_dir               VARCHAR2(20)    := 'CSV_DIR';

        l_file              VARCHAR2(150)   := 'xxitemimport.zip';

        l_content_type      VARCHAR2(10)    := 'zip';

        l_doc_author        VARCHAR2(10)    := 'int_iface';

        l_doc_sec_grp       VARCHAR2(50)    := 'FAFusionImportExport';

        l_doc_account       VARCHAR2(100)   := 'scm/item/import';

        l_bfile             BFILE;

        l_blob              BLOB;

        l_result            XMLTYPE;

        l_envelope          CLOB;

        l_blob_v            BLOB;

        l_clob              CLOB;

        l_filename          VARCHAR2(150);

        l_response_msg      VARCHAR2(32767);

        l_doc_id            VARCHAR2(100);

    BEGIN

        /*Delete existing file with same name*/

       

        DELETE FROM xx_ucm_zip_lob

        WHERE file_name = l_file;

        COMMIT;

       

        /*Read zip file from Directory and load into lob table*/

        INSERT INTO xx_ucm_zip_lob (file_name, doc, creation_date)

        VALUES (l_file, empty_blob(), sysdate)

        RETURN doc INTO l_blob;

        l_bfile := BFILENAME(l_dir, l_file);

        DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);

        DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));

        DBMS_LOB.fileclose(l_bfile);

        COMMIT;

       

        /*Get Content of lob and convert into base64 format*/

        SELECT file_name, doc

        INTO l_filename, l_blob_v

        FROM xx_ucm_zip_lob

        WHERE file_name = l_file;

        l_clob := apex_web_service.blob2clobbase64(l_blob_v);

        -- Construct xml payload to invoke the service. In this example, it is a hard coded string.

        l_envelope := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/" xmlns:erp="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">

        <soapenv:Header/>

        <soapenv:Body>

        <typ:uploadFileToUcm>

        <typ:document>

            <erp:Content>'||l_clob||'</erp:Content>

            <erp:FileName>'||l_file||'</erp:FileName>

            <erp:ContentType>'||l_content_type||'</erp:ContentType>

            <erp:DocumentAuthor>'||l_doc_author||'</erp:DocumentAuthor>

            <erp:DocumentSecurityGroup>'||l_doc_sec_grp||'</erp:DocumentSecurityGroup>

            <erp:DocumentAccount>'||l_doc_account||'</erp:DocumentAccount>

         </typ:document>

        </typ:uploadFileToUcm>

        </soapenv:Body>

        </soapenv:Envelope>';

        /*Invoke web service call*/

        l_result := apex_web_service.make_request(

            p_url => 'https://adc-fap0828-fa-ext.oracledemos.com:443/publicFinancialCommonErpIntegration/ErpIntegrationService?WSDL',

            p_action => 'http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/ErpIntegrationService/uploadFileToUcm',

            p_envelope => l_envelope,

            p_username => 'scm_impl',

            p_password => 'XXXX',

            p_wallet_path => 'file:/u02/oracle/DEMO1226/12.1.0/admin/DEMO1226/cloud_wallet',

            p_wallet_pwd  => 'WalletPasswd123'

            );

           

        dbms_output.put_line(l_result.getClobVal());

       

        -- Pull out the document id for interface load.

        l_doc_id := APEX_WEB_SERVICE.parse_xml(

            p_xml   => l_result,

            p_xpath => '//result/text()',

            p_ns    => 'xmlns:ns1="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/"'

            );

           

           

        DBMS_OUTPUT.put_line('l_doc_id=' || l_doc_id);  

               

    EXCEPTION

WHEN OTHERS THEN

dbms_output.put_line('Exception in upload_file_to_ucm: '||substr(sqlerrm, 1, 250));

    END;

Error,

<?xml version='1.0' encoding='UTF-8'?><err><sqlerrm><![CDATA[ORA-31011: XML parsing failed

ORA-19213: error occurred in XML processing at lines 1

LPX-00210: expected '<' instead of '-']]></sqlerrm><response><![CDATA[------=_Part_43225_172115573.1518047238436

Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"

Content-Transfer-Encoding: 8bit

Content-ID: <7a87e52d-5781-472c-b612-b4ed98436bdf>

<?xml version="1.0" encoding="UTF-8" ?>

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">

<env:Header><wsa:Action>http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService//ErpIntegrationService/uploadFileToUcmResponse</wsa:Action>

<wsa:MessageID>urn:uuid:3d851689-8ca8-4cfd-b09e-9eac5431d51c</wsa:MessageID>

</env:Header>

<env:Body>

<ns0:uploadFileToUcmResponse xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/">

<result xmlns="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/">2070296</result>

</ns0:uploadFileToUcmResponse>

</env:Body>

</env:Envelope>

------=_Part_43225_172115573.1518047238436--

]]></response></err>

l_doc_id=

If anyone has idea what is missing?

Thanks,

Santosh

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2018
Added on Feb 7 2018
12 comments
2,374 views