on 2024 Feb 02 2:29 PM
Hello,
We developed a CAP EndPoint in BTP, so that an external system (Ariba Network) can POST requests (Punchout request) to it, and get in return some specific informations.
The issue is that when Ariba Network is calling our application by sending an HTTP POST request with cXML body and headers that we can not see, we are getting a 500 error in Ariba's side (application.cxml.punchout:WARN) [ID2652]: Unmatched messageID& argument values are: 2652,500,Error). Meanwhile, the application log in BTP side we get this "msg":"Wrong accept header value 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2'", Could you help us to understand. (I want to mention that we can not change the headers/payload of ariba request, we need to align our API to them).
This is how our API is built:
Our service definition is :
service punchoutService @(path: '/Punchout') {
@Core.Description: 'Handles PunchOut Setup Requests'
action handlePunchOutSetupRequest(POSR : String)returns String;
}
And our service implementation is:
module.exports = srv => {
srv.before('handlePunchOutSetupRequest', req => {
req._.res.set('Content-Type', 'text/xml, application/xml');
req._.res.set('accept', '*/*');
console.log('Received Headers (before):', req.headers);
});
srv.on('handlePunchOutSetupRequest', req => {
const { POSR } = req.data;
console.log('Received Headers: (on)', req.headers);
console.log('Received XML:', POSR);
req._.res.set('Content-Type', 'text/xml, application/xml');
req._.res.set('accept', '*/*');
const responseXML = generatePunchOutSetupResponse();
return {
responseXML
};
});
});
}
what we need to know is :
1) why the BTP server is rejecting ariba's request?
2) How to capture HTTP Request objets coming from Ariba in BTP (Headers and Payload)
3) Is it possible to accept a content-type in BTP action other than application/json ? (it does not seem to be the case)
Thank you!
I faced the same issue when i was trying to call the api (action) from ".http" extension file,
the issue got resolved when i updated the request header from content-type : 'application/json'
to content-type : application/json.
It would look something like this
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.