Skip to Content
0
Aug 03, 2023 at 07:11 PM

Trouble sending Print Queue Push Notifications to BTP Destinations

65 Views

I have a print queue that I would like to have send Push Notifications to a BTP app so that the app can pull work off the print queue for OMS processing.

This BTP app is currently very simple, based on tutorial https://developers.sap.com/tutorials/s4sdk-cloud-foundry-sample-application.html. I added a new endpoint, /push, that accepts POSTs and I can POST to it with Postman. Of course, by default it gives 403 Forbidden unless I GET or HEAD to fetch an x-csrf-token and then POST with that x-csrf-token.

To configure the Print Queue to send Push Notifications, I have set up a BTP Destination, NoAuth:

Name: Print-Push
Type: HTTP
Description: Push notification for print app
URL: https://printapp-<account>.cfapps.us10-001.hana.ondemand.com/push
Proxy Type: Internet
Authentication: NoAuthentication

The destination tests successfully, 200 OK, and I see in the logs:

HEAD /push HTTP/1.1" 403 0 0 
GET /push HTTP/1.1" 200 0 32

The test, at least, seems to be doing the CSRF dance correctly.

However when I place a document in the print queue, I see:

POST /push HTTP/1.1" 403 118 86 
POST /push HTTP/1.1" 403 118 86
POST /push HTTP/1.1" 403 118 86

3 times for each document placed in the queue (presumably some built-in retry).

How do I get the Print Queue Push Notifications to request and use x-csrf-tokens correctly?

(I tried all of this initially with the app secured behind an xsuaa-enabled Approuter and I get 401s when testing and the 3 print notifications do not even appear in the approuter logs, even on DEBUG level.)