From reactive app overriding xmlhttprequest.prototype.send Im trying to send an additional header to outsystem Service/Server action.
From Server action im able to read the additional header which I sent, but in case of Service action not able to read the header.
And whem Im writing additional header from Service/Server action, in Service action not returning the additional header in http response.
Any solution to read/write the additional header from Service Action.??
Hi Sadikul Sayed,
Did you use that code in service action? in the service action use the server action that you have created previously it should work.
Hope that it helps you
Hi Alexandre, in both service/server action I have used the same code.
Using HTTPRequestHandler.GetRequestContent I tried to read request context, I see a difference btn service and server action.
From the same application while calling a server action requested headers and body are same inside server action, but in case of service action its getting changed. Here is a sample
my suggestion is to use the server action with the code directly in the service action.
Can you try it?
Regards
Hi Alexandre,
Im have tried the same, but no luck yet.
And my analysis is, in ousystems some kind of gateway has been implemented while calling a service action. Once ousystems receive a service action, the gateway reroute the request to another service.
Hi,
What are you trying to achieve with sending an additional header to a service action?
-- Daniel
Hi Daniel,
What I trying to achive, adding additional Authorization checks in Server/Service Action. I have implemented SSO in Outsystems and for Authorization im not using anything providev by Outsystems. After authentication I will get the access token, and that token I want to pass in all the Server/Service action, and inside the Server/Service action I will add my Authorization check logic. To achive this I want to pass the access token to all the Server/Service action by overriding xmlhttprequest.prototype.send.
Note: From Reactive app im calling Server/Service action, not rest api.
Alright, interesting, please share if you get this working.
One question, why are you not using the normal Role-Based-Access validation in actions?
Im not using Role-Based-Access validation, permission/roles is managed by a saperate service, and after authentication I have a access token which contains some claims for permission/roles. Outsystems dont have any information about those permission/roles and dont have access to the database where its getting managed.
Just an idea, in the service action if you output the x-correlation-id value it would be suitable for you?
In Service Action nither I can read additional header which Im sending, nor I can write additional header into my response, and that header is not coming to my response.
But in Server both are working fine.
I probably was not clear, first your javascript could retrieve as output the x-correlation-id value which I believe is what you want to to check after.
Secondly in the service action add as well an output parameter and assign the javascript output value.
Here is what im trying to do
Step 1: Send an additional header, lets say x-correlation-id from using javascript to all the service action
Step 2: Read the header i.e x-correlation-id from Service action. (which is not working)