Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SetResponsetHeaderField
HTTPClient_Services('SetResponsetHeaderField',"ACCOUNT","LAN")
I dont see header set here in POSTMAN:
So, what am I still missing.
Comments
thank you, thank you - so sorry
Still dont see it in the response header
API ping.GET HTTP_Services('SetResponseHeaderField', 'ACCOUNT', 'LAN') Properties = 'currentDateTime' Values = SRP_DateTime('Format', SRP_DateTime('Now', True$), "DDD, DD MMM YYYY hh:mm:ss 'GMT'") objResource = HTTP_Resource_Services('AddProperties', '', Properties, Values) Rels = 'self' : @FM : 'apiEntryPoint' URLs = FullEndpointURL : @FM : APIURL HTTP_Resource_Services('AddLinkRelations', objResource, Rels, URLs) If Error_Services('NoError') then // Serialize the object into a JSON string. jsonResource = HTTP_Resource_Services('GetSerializedResource', objResource) // Set the response body with the JSON string and set the Content-Type response header. HTTP_Services('SetResponseBody', jsonResource, False$, 'application/hal+json') end else HTTP_Services('SetResponseError', '', '', 500, Error_Services('GetMessage'), FullEndpointURL) end end api
Then test this API in Postman. Here's what I get:
If this still fails, there could be a problem with your web server filtering out non-standard request headers.
>>I'm also curious that you got a misspelled service. Are you using the SRP Editor to auto-list and autofill your service names?
I would have had SetRequestHeaderField when trying to get work and then edited it to change to 'Response' (but badly)
HTTP_Services('SetResponseHeaderField', 'ACCOUNT', 'LAN')
Is there a further setting that I or the WEB Developer needs to do to be able to read this in the header.
HomeURL = HTTP_Services('GetHomeURL')
HTTP_Services('SetResponseHeaderField',"Access-Control-Expose-Headers","ACCOUNT,WWW-Authenticate")
HTTP_Services('SetResponseHeaderField',"Access-Control-Allow-Origin",HomeURL)
Just upgrading now and will see how it goes.
I think he is missing something at his end, but, what do I know.!!
All good now.
//it looks like this gets from response header//
DataPath=HTTP_Services('GetHTTPCookie', CookieName)
//if DataPath empty, check if can get from request header//
MyCookies = http_services('getRequestHeaderField','Cookie')
I do this to set it:
HTTP_Services('SetCookie', CookieName, DataPath)
Not a deal breaker. I initially read a control file to get the data folder location to attach, so, I thought if I could then 'save it' I would not need to read again. (just a little i/o save)
You must require access to the request headers, so, I think this could work.
MyCookies = http_services('getRequestHeaderField','Cookie')
I have put a temporary trace in to see which is working when he does his testing.
Here is my code for that section:
// dont use registry additionalvalues as could break future use by oecgi4 /// DataPath =null$ CookieName ='pbcdatapath' pbcdatapath = HTTP_Services('GetHTTPCookie', CookieName) oswrite pbcdatapath to 'c:\temp\pbcdatapath':RTI_CreateGUID():'.txt' if pbcdatapath then DataPath = pbcdatapath[-1,'B='] end else MyCookies = http_services('getRequestHeaderField','Cookie') oswrite MyCookies to 'c:\temp\MyCookies':RTI_CreateGUID():'.txt' if MyCookies then convert ';=' to @fm:@vm in mycookies For Each Field in mycookies using @FM if Field<0,1> _eqc CookieName then DataPath = Field<0,2> end CookieFields<-1> =Field<0,1> CookieValues<-1> =Field<0,2> Next Field end end
this worked:
pbcdatapath = HTTP_Services('GetHTTPCookie', CookieName)