Discussions
Categories
- 197K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.8K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 556 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.4K SQL Developer
- 296.4K Development
- 17 Developer Projects
- 139 Programming Languages
- 293.1K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 161 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 475 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
How to get Response from apex_web_service.make_rest_request??

Hi,
I have a NodeJS application which host my REST Webservice to return a PDF document as a Base64 encoded string data. I am calling this web service from APEX using the following code
DECLARE
l_cursor SYS_REFCURSOR;
l_body_clob clob;
l_resp_clob clob;
l_blob BLOB := empty_blob();
--l_blob BLOB;
l_step number := 22500;
BEGIN
DBMS_LOB.OPEN(l_blob, DBMS_LOB.LOB_READONLY);
OPEN l_cursor FOR
SELECT cust.customer_name,
cursor(select
products.product_name
,case
when products.uom_type ='RANGE_VALUE' then
products.range_low||products.uom||'-'||products.range_high||products.uom
else
products.absolute_value||products.uom
end reference_range
from xxdiag.xxeba_patient_order_lines_all lines,
xxdiag.eba_cust_products products,
xxdiag.eba_cust_product_families fam
where orders.order_header_id = lines.order_id
and lines.product_id = products.id
and products.product_family_id = fam.id) lines
FROM xxdiag.eba_cust_customers cust,
xxdiag.xxeba_patient_orders orders
WHERE orders.customer_id = cust.id;
APEX_JSON.initialize_clob_output;
APEX_JSON.open_object;
APEX_JSON.write('orders', l_cursor);
APEX_JSON.close_object;
l_body_clob := APEX_JSON.get_clob_output;
apex_web_service.g_request_headers.delete();
apex_web_service.g_request_headers(1).name := 'Content-Type';
apex_web_service.g_request_headers(1).value := 'application/json';
apex_web_service.g_request_headers(2).name := 'TemplateName';
apex_web_service.g_request_headers(2).value := 'Biochemistry';
l_resp_clob := apex_web_service.make_rest_request(
p_url => '***' - the REST WebService URL
p_http_method => 'POST',
p_body => l_body_clob
);
DBMS_OUTPUT.put_line('Response:'||l_resp_clob);
APEX_JSON.free_output;
END;
But I am not able capture the response. When I call the same web service using soapui I get the response.
Could you please help me?
Thanks,
Mehabub
Best Answer
-
Check : apex_web_service.g_status_code
This will give you the status code. Use the number to help determine the issue.
Answers
-
Check : apex_web_service.g_status_code
This will give you the status code. Use the number to help determine the issue.
-
Thanks for the guidance. I was getting return status 400 and I could figure out the mistake. I corrected it and now it is working as expected.
Thanks for your help.
Mehabub