Reputation: 3828
I cannot seem to get CF REST to work at all. After trying the docs and a couple articles verbatim, I get a 404.
I am using apache - and according to other posts, JkMountFile "C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties" May be needed - I added it just in case, but that doesn't seem to make a difference.
APACHE VHOST
<VirtualHost *:80>
ServerName 127.0.0.1
ServerAlias 127.0.0.1
DocumentRoot "C:/wwwroot/CFREST2"
ErrorLog "C:/wwwroot/CFREST2/logs/error.log"
CustomLog "C:/wwwroot/CFREST2/logs/access.log" combined
JkMountFile "C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
<Directory "C:/wwwroot/CFREST2/logs/">
AllowOverride None
Options None
Order allow,deny
Deny from all
</Directory>
</VirtualHost>
Example:
CFADMIN - registered
Root path: C:\wwwroot\CFREST2
Host: 127.0.0.1
Service Mapping: test
FILE: (C:\wwwroot\CFREST2\rest3.cfc)
<cfcomponent rest="true" restpath="restService" >
<cffunction name="sayHello" access="remote" returntype="String" httpmethod="GET" >
<cfset rest = "Hello World" >
<cfreturn rest >
</cffunction>
MAKING GET REQUEST IN POSTMAN:
http://127.0.0.1/rest/test/restService/
RETURNS:
404
MAKING GET REQUEST IN POSTMAN:
http://127.0.0.1/rest/test/restService/sayHello
RETURNS:
404
I have tried a few variations, abut ALWAYS get the 404.
Upvotes: 3
Views: 460
Reputation: 432
FWIW, over 4 years after the question was asked, and I haven't used CF for a while, and I'm trying to work my way through setting up a RESTful service.
I was getting a 404, and saw this in my exception.log:
java.io.FileNotFoundException: .../cfusion/wwwroot/WEB-INF/rest-skeletons/path.to.component.Fubar.class (Permission denied)
I checked and the account running the service didn't have permission to write to the "rest-skeletons" directory. I changed that, no more 404, on to the next problem!
Upvotes: 1
Reputation: 164
Try to initialize by running this in the separate .cfm file:
<cfset restInitApplication("C:\wwwroot\CFREST2","test")>
To call: http://127.0.0.1/rest/test/restService
Upvotes: 0