Manoj K · Feb 27, 2017

Unable to run this file REST Class file in USER Namespace

Hi, I tried the new rest file in User namespace. But I couldn't run it.

Here the Code:

Class com.Testing Extends %CSP.REST

XData UrlMap
<Route Url="/insert" Method="POST" Call="one"/>
<Route Url="/print" Method="POST" Call="two"/>
<Route Url="/update" Method="POST" Call="three"/>

ClassMethod one()
Write "This is 1st Method!!"

ClassMethod two()
Write !,"This is 2nd method"

ClassMethod three()
Write !,"This is 3rd Method"


I tried it in the below link:


Can anyone help me resolve this error?

0 395
Discussion (5)1
Log in or sign up to continue

Looks like you forgot to define web application for your REST Service.  Please look at the documentation. And at this part:

Each subclass that has its own entry point must have its own CSP web application. You define the CSP web application and specify its security for on the Management Portal’s [Home] > [Security Management] > [Web Application] page, which you can access by clicking System AdministrationSecurityApplications, and Web Applications. When you define the CSP web application, you set the Dispatch Class to the name of the custom subclass of %CSP.REST and specify the first part of the URL for the REST call as the name of the application.

Amplifying what Dmitry wrote, here's the web app I defined to make your example class work:

I also had to change your classmethods so they Quit $$$OK instead of simply quitting.

And to test from the browser I used http://localhost:57772/csp/user/testing/print because that's the route you have defined as accepting the GET method from the browser.

There's a REST sample (REST.DocServer) in the SAMPLES namespace. To use it you need to enable the /csp/samples/docserver web application by setting this checkbox:

Then this URL will return the source of the Cinema.Review class from the SAMPLES namespace:


Given that this REST sample will return the source of any class from any namespace, it's understandable that the /csp/samples/docserver application is disabled by default on a new installation.

Thanks Dmitry and John yes

I missed the Dispatch Class

Glad to have helped. Please click the checkmark alongside one of the answers so that the question no longer lists as "unanswered".

In addiction to that answer, don't forget to set the Application Role to %All (or other role that you need), or it always returns a "Forbidden" error.

Best regards,