Hello,
I've been getting a 403 error whenever I try and access a REST Service resource set up and published on an active PASOE server.
I am passing query string parameters to the service and getting output parameter from the same.
Both input and output mapping details is correct ( used REST Resource URI Editor).
Below is the ABL call to the service -
/* *************************** Definitions ************************** */
USING OpenEdge.Net.HTTP.*.
USING OpenEdge.Net.URI.
USING Progress.Json.ObjectModel.JsonObject.
DEFINE VARIABLE oClient AS IHTTPClient NO-UNDO.
DEFINE VARIABLE oURI AS URI NO-UNDO.
DEFINE VARIABLE oCredentials AS Credentials NO-UNDO.
DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO.
DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO.
DEFINE VARIABLE oCookies AS Cookie NO-UNDO.
oClient = ClientBuilder:Build():KeepCookies():Client. /*CookiesJarBuilder:Build():CookieJar*/
oURI = NEW URI('http', 'localhost', 10980).
#oURI:Path = '/myRestServicesService/rest/myRestServicesService/testQueryParameters?MNR=2000&SNR=1'.
oURI:Path = '/rest/myRestServicesService/testQueryParameters?MNR=2000&SNR=1'.
oCredentials = NEW Credentials('Tomcat Manager Application', 'tomcat', 'tomcat').
oRequest = RequestBuilder:Build('GET', oURI)
:usingBasicAuthentication(oCredentials)
:acceptJson()
:Request.
oResponse = ResponseBuilder:Build():Response.
/*oClient:execute(oRequest, oResponse).*/
oResponse = ClientBuilder:Build():Client:Execute(oRequest).
MESSAGE oResponse:StatusCode skip oResponse:StatusReason
VIEW-AS ALERT-BOX INFO BUTTONS OK.
***************************************************** END***************************************************
*****************************************Service***********************************
****************************************END***************************************
I tried below both URL but received same error in response.
#oURI:Path = '/myRestServicesService/rest/myRestServicesService/testQueryParameters?MNR=2000&SNR=1'.
oURI:Path = '/rest/myRestServicesService/testQueryParameters?MNR=2000&SNR=1'.
Below is the response If I try these URLs from browser -
An error occurred while executing your request!
403 - Forbidden: the server refuses to fulfill the client's request - GET /myRestServicesService/rest/myRestServicesService/testQueryParameters
Error details | |
Remote user: | null |
User principal: | null |
Scheme: | http |
Remote address: | 0:0:0:0:0:0:0:1 |
Server name: | localhost |
PASOE product type: | dev |
HTTP status: | 403 |
Error detail: | Access Denied |
Pls suggest.
You have a few unnecessary lines in your code example.
this line isn't doing anything since you don't use the result further down:
oClient = ClientBuilder:Build():KeepCookies():Client. /*CookiesJarBuilder:Build():CookieJar*/
and this line isn't doing anything either because you immediately overwrite it on the next line:
oResponse = ResponseBuilder:Build():Response.
Actually, I have installed all the setup on my local machine only right from developer studio to OE Management. I am testing it from the developer studio.
Even after removing those cookies statements getting the same error.
Did you test with another product like postman or with opening the URL in a browser and providing the same credentials?
How can we pass the credentials in the URL to test it from the Browser ?
Earlier i tested with URL localhost:10989/.../testQueryParameters
And the result is -
An error occurred while executing your request!
403 - Forbidden: the server refuses to fulfill the client's request - GET /myRestServicesService/rest/myRestServicesService/testQueryParameters
Error detailsRemote user:nullUser principal:nullScheme:httpRemote address:0:0:0:0:0:0:0:1Server name:localhostPASOE product type:devHTTP status:403Error detail:Access Denied
You can put them in the URL...or if you don't, the browser should be prompting for them. if it doesn't restart the browser and try again, since the browser will cache them if you already provided them.
You can add them to the URL as such.
tomcat:tomcat@localhost:10989/.../testQueryParameters
If that doesn't work...then you have the wrong credentials.
With that I am getting below pop up error -
[Window Title]
Address Bar
[Content]
Windows cannot find ‘tomcat:tomcat@localhost:10980/.../testQueryParameters. Check the spelling and try again.
[OK]
But above credentials are correct. I am using same credentials for the OE Explorer.
I meant to say tomcat manager credentials. I have different credentials for OE Explorer/Management
I meant so say tomcat manager credentials. I have different credentials for OE Explorer/Management
then what sould be there ?
Which credentials ?