Help with REST URI?/403 error

Posted by bstaunton on 20-Mar-2018 09:28

Hi, 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 want to make sure I've got the URI right first of all. The RESTService is called TestLCRService, the Resource is called /Customer, the input parameter in the procedure the GET request is linked to is called pifilter, the query string parameter of this has been named cust-code.So the correct URI is

<computer-name-on-local-network:PASOE-HTTP-Port/TestLCRService/customer/cust-code/1

with the 1 being for the value of the parameter right? I've tried a few variations of this. Am I meant to use ${rest.queryparam['cust-code']} instead? I don't know what to fill in where on that. Thanks in advance.

All Replies

Posted by egarcia on 20-Mar-2018 12:41

Hello,

The URL that you are using is missing "rest". This would generally return a 403 error.

You would need "rest" between the web application and the service name.

Example:

oemobiledemo.progress.com/.../Customer

I hope this helps.

Posted by bstaunton on 22-Mar-2018 04:31

Hi [mention:98b1534299774239b816c694c6295179:e9ed411860ed4f2ba0265705b8793d05], how do I know what the web application is called? This is only if you deploy as a web app right? Which I don't think I have done. I have a REST Service attached to my PASOE server called TestLCRService and have tried /TestLCRService/rest/TestLCRService/customer/1 like is recommended here https://knowledgebase.progress.com/articles/Article/How-to-find-the-URI-of-a-REST-service but it still returns 403.

Posted by Sanjeva Manchala on 22-Mar-2018 05:34

Hi,
 
If you are deploying any REST service to PAS OE server, then the URL format to access the service is: <http/https>://<hostname>:<port>/<WebAppName>/<transport>/<ServiceName>/<ResourceName> (eg: http://localhost:8810/SportsApp/rest/SportsRestService/CustomerBE).
 
If you are deploying any REST service to classic tomcat server (restmgr1), then the URL format to access the service is: <http/https>://<hostname>:<port>/<ServiceName>/<transport>/<ServiceName>/<ResourceName> (eg: localhost:8810/.../CustomerBE).
 
In case of classic server, each service is treaded a separate webapp and a war file is created with service name (by default) and then published to classic tomcat server. But, if you are working with PAS OE server, then all the services under one project are grouped and published as one war file (default webapp name is project name).
 
Since you are using PAS OE server, I think your URL should be like this: <connection>/TestLCR/rest/TestLCRService/customer/1 (assuming project name is TestCLR). You can see the actual URI information from PDS OE. Expand “Defined Services” node under project and then double click on the service which you want to access. It’ll open “Edit ABL service” dialog and click Next and select the resource which you want to access. At the bottom of the wizard you can actually see the sample URI like this: http://<host>[:port]/SportsApp/rest/SportsRestService/CustomerBE
 
Hope this helps,
Sanjeev

Posted by bstaunton on 22-Mar-2018 05:44

Hi Sanjeev, this does help. By renaming the first term after the <connection> to the project name I now get a 404 error instead of a 403 which i assume is progress? Now I have that as a new problem though haha. As for editing the service, it just brings up the REST Service mapping GUI which doesn't have a sample URI. Though I can see it if I try to make a new REST service with the same name. Thanks, that's useful for future

Posted by Sanjeva Manchala on 22-Mar-2018 06:02

I should have mentioned clearly in previous post, for simple REST service, PDS OE won’t show sample URI section. For Data Object Services, PDS OE shows sample URI section. If possible please share the REST mapper screenshot, so that we can take a look about sample URL. You can be able to construct the URL easily from what I have posted in previous reply. <http/https>://<hostname>:<port>/<WebAppName>/<transport>/<ServiceName>/<ResourceName>
 
Thanks,
Sanjeev
 

Posted by bstaunton on 22-Mar-2018 06:10

Hi, the URL I'm using currently is http://<connectionstring>/TestLCR/rest/TestLCRService/customer/1 which I assume is right as I go back to a 403 error if I modify the URI at all.

Here is a screenshot of the REST mapping editor.

Posted by Sanjeva Manchala on 22-Mar-2018 08:28

Hi,
 
I think the URL you are hitting seems to be proper until Resource name. I’m not sure how you are handling path parameter (in your case it is ‘1’) in your ABL code.
 
I did some basic testing with your mapping details (input parameter to “Complete URL” and output parameter to body) and I’m getting the response properly when access the service.
 
Here is the sample abl code snipped, I have tried:
@openapi.openedge.export FILE(type="REST", executionMode="external", useReturnValue="false", writeDataSetBeforeImage="false").
 
BLOCK-LEVEL ON ERROR UNDO, THROW.
 
DEFINE INPUT PARAM inp AS CHARACTER.
DEFINE OUTPUT PARAM out AS CHARACTER.
 
out = "Request URL: " + inp.
 
Output from browser: Request URL: localhost:8820/.../custom
 
Please open a case with Tech Support, so that they can I assist you better by looking into your ABL code and REST mapping details.
 
Here is the screenshot of my mapper with both input and output mapping details:
 
Hope this helps,
Sanjeev
 

Posted by bstaunton on 22-Mar-2018 09:18

Hi Sanjeev, thanks for the detailed reply. I had reached the point, before your reply, where if I used http://<connectionstring>/TestLCR/rest/TestLCRService/customer with a file that does what yours does, supposedly just outputting the string entered in, then it instead outputs the URI back out again. If I entered anything after /customer/ I'd get a 404 error. I was using the default executionMode = "singleton" though, using executionMode = "external" didn't work.

The same thing happens when I run your exact code and mapping. Instead of outputting the input string, it outputs a string of the whole URI: http://<connectionstring>/TestLCR/rest/TestLCRService/Customer

Posted by Sanjeva Manchala on 22-Mar-2018 09:30

I think, I can’t be of much help from this point since I don’t know about your business logic and complete mapping details and what you are trying to achieve. As I said earlier, please open a support case to get it resolved.
 
Thanks,
Sanjeev.
 

Posted by bstaunton on 22-Mar-2018 09:33

OK, thank you very much for your help so far, I really appreciate it!

This thread is closed