Matthew Martinez
Matthew Martinez

Reputation: 13

Retrieving HTTP POST Request Body in an APEX application when coming from External Application

I am attempting to develop a Requisition application in Oracle APEX using the cXML Request/Response standard with an external supplier partner. The process starts in APEX by building a cXML request to our supplier partners endpoint. Via an APEX Processing processes (button click fires process), I build a cXML payload with credentials and a return URL to the APEX application. The external partner validates by request and sends a response with their external URL. I then can navigate to the external punchout site from my APEX application using a branch. This is all working fine.

In the external suppliers site, I can order items from JIT catalogs and add them to a cart. Once I am done shopping on the external site, I checkout with cart items Those items are constructed in a cXML payload and set back to my APEX page via a POST (using the URL I provided in the SetupRequest payload). I am able to get back to my APEX application from the external punchout site, but I can't figure out how to get the POST Request body in APEX. I can see in my browser web tools that the external site is adding the URL encoded form values in the request body on the redirect back to APEX, but I can't see to grab those values in PL/SQL in the Pre-rendering event.

I think I might need to capture the values in a Dynamic Action which would fire on page load when coming back from the external (non-APEX) application. Can any experience APEX developers give me some insight on how I might get the form values? Again, this is all happening in the browser and not via API call in PL/SQL.

I've tried to use a pre-processing event that looks for the global variables (apex_application.g_x01). I've also tried to dump the owa_util.print_cgi_env, but I am not seeing the url encoded cXML payload I would expect on the return to APEX from the external punchout application.

Upvotes: 0

Views: 281

Answers (1)

Koen Lostrie
Koen Lostrie

Reputation: 18685

Interesting problem. Here is my 2 cents but there are probably better solutions. I don't think you can send a post request to an apex page. Apex pages are all GET requests so the request body will not be accessible. I'd suggest starting by writing the entire process in pl/sql. To handle the post request, create your own REST handler to process the data. Once you have it working add the APEX app to the logic. In the post request, process the payload and use the :location bind variable to redirect to the apex application.

Upvotes: 0

Related Questions