I am trying to call a Workday SOAP web service from Oracle. I am able to do it from Postman, but anything I try in Oracle just returns the same 500 error message:
"<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc"><faultcode>SOAP-ENV:Client.validationError</faultcode><faultstring>Invalid request</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>"
This is a SOAP call using OAuth2 and I have the access token (Bearer) which is sent as a header.
Does anyone know what I am doing wrong or missing with this code below?
DECLARE
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_buffer VARCHAR2(32767);
l_access_token VARCHAR2(32767);
l_soap_body VARCHAR2(32767) := '<?xml version="1.0" encoding="utf-8"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"><env:Body><wd:Get_Cost_Centers_Request xmlns:wd="urn:com.workday/bsvc" wd:version="v43.0"><wd:Response_Filter><wd:As_Of_Effective_Date>2024-09-23</wd:As_Of_Effective_Date><wd:As_Of_Entry_DateTime>2024-09-23T21:33:15</wd:As_Of_Entry_DateTime><wd:Page>1</wd:Page><wd:Count>100</wd:Count></wd:Response_Filter><wd:Response_Group><wd:Include_Reference>true</wd:Include_Reference><wd:Include_Cost_Center_Data>true</wd:Include_Cost_Center_Data></wd:Response_Group></wd:Get_Cost_Centers_Request></env:Body></env:Envelope>';
l_url VARCHAR2(32767) := 'https://<workday-tenant>';
BEGIN
-- Get the access token
l_access_token := F_GET_TOKEN;
-- Prepare and send the SOAP request
l_http_request := UTL_HTTP.begin_request(l_url, 'POST', 'HTTP/1.1');
UTL_HTTP.set_header(l_http_request, 'Content-Type', 'text/xml');
UTL_HTTP.set_header(l_http_request, 'Content-Length', LENGTH(l_soap_body));
UTL_HTTP.set_header(l_http_request, 'Authorization', 'Bearer ' || l_access_token);
UTL_HTTP.write_text(l_http_request, l_soap_body);
l_http_response := UTL_HTTP.get_response(l_http_request);
BEGIN
LOOP
UTL_HTTP.read_text(l_http_response, l_buffer);
DBMS_OUTPUT.put_line(l_buffer); -- Output the response
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body THEN
NULL;
END;
UTL_HTTP.end_response(l_http_response);
END;
Many thanks.