Forum Stats

  • 3,814,142 Users
  • 2,258,826 Discussions
  • 7,892,587 Comments

Discussions

I can't make SOAP request with apex_web_service.make_request, I got "PLS-00382: expression is of wr

Geekinto
Geekinto Member Posts: 111 Blue Ribbon
edited Mar 7, 2019 7:09AM in APEX Discussions

Hi All,

DB: 18c Standard Edition 2 Release 18.0.0.0.0

Using: SQLDev 18.4

have this function pkg_file.get_xml_clob returns  XML clob.

I have SOAP URL http://192.168.1.83/CmcGlm/Fileinhlh.svc to post this XML Clob to it.

So when i execute the next code i got this error

Error report -
ORA-06550: line 19, column 19:
PLS-00382: expression is of wrong type
ORA-06550: line 19, column 9:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.

I need your help please,

Thanks in advance

set SERVEROUTPUT ONdeclare    l_clob      clob;    l_resp      clob;begin        l_clob := pkg_file.get_xml_clob(p_file_id =>7570);                l_clob := '<?xml version="1.0" encoding="UTF-8"?>                    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"                      xmlns:xs="http://www.w3.org/2001/XMLSchema">                      <soap:Body>'                        || l_clob ||                      '</soap:Body>                    </soap:Envelope>';                                                l_resp := apex_web_service.make_request(p_url         => 'http://192.168.1.83/CmcGlm/Fileinhlh.svc',                                                p_envelope        => l_clob );       dbms_output.put_line(to_char(l_resp));end;
Tagged:

Best Answer

  • Pavel_p
    Pavel_p Member Posts: 2,312 Gold Trophy
    edited Mar 7, 2019 5:32AM Answer ✓

    Hi,

    unlike apex_web_service.make_rest_request (that returns clob) the function make_request returns xmltype https://docs.oracle.com/database/apex-5.1/AEAPI/MAKE_REQUEST-Function.htm#AEAPI1950 so the l_resp must be declared accordingly. Also the function to_char is overloaded and takes various types of input parameters (number, date...) but not clob nor xmltype, so if you want to print your output, you need to pass dbms_output.put_line an appropriate input parameter datatype.

    declare  l_clob  clob := 'abcde';  l_resp  xmltype;--not clobbegin   l_clob := pkg_file.get_xml_clob(p_file_id =>7570);   l_clob := '<?xml version="1.0" encoding="UTF-8"?>                     <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"                       xmlns:xs="http://www.w3.org/2001/XMLSchema">                       <soap:Body>'  ||  l_clob  || '</soap:Body>                     </soap:Envelope>';  l_resp := apex_web_service.make_request(p_url => 'http://192.168.1.83/CmcGlm/Fileinhlh.svc',p_envelope => l_clob);  --dbms_output.put_line(to_char(l_resp) );  dbms_output.put_line(l_resp.getClobVal() );--assuming that the l_resp is less than 32kend;

    Regards,

    Pavel

Answers