I cannot seem to get my REST service to work... I get a 404 when I call the URL.
Im running Win 7, CF 10 developer, Apache webserver. I've developed on this for years, so the setup works - but this is my first go at REST services thru CF... I mention that because CF is working, the dir and webserver are working etc.
Directory looks like this
C:\wwwroot\restTest
CODE - saved as "obj1.cfc" - ( Note: I've tried restpath with and without the / )
<cfcomponent restpath="/restTest" rest="true" >
<cffunction name="getMethod" access="remote" returntype="String" httpmethod="GET" >
<cfreturn "this is a string returned" />
</cffunction>
</cfcomponent>
The coldfusion ADMIN setup looks like this
Root path: 'C:\wwwroot\restTest'
Service Mapping: 'test'
I'm using the service mapping because I don't have an associated application name - no Application.cfc - I was trying to keep this super simple.
I get a green 'success' message when I set that path
Browse to -
127.0.0.1/rest/test/restTest/
result - 404
What am I doing wrong? It is my understanding that "/rest/" is a default mapped path in CF for routing the service - I may be wrong, but I know I read it somewhere - and the examples all use it. I also believe I can change that either in the admin or in some XML file...
Turns out - Apache needed this line added to the host (or globally in the config)
JkMountFile "C:/ColdFusion10/config/wsconfig/1/uriworkermap.properties"
Once I added that... all was good.
Related
I'm getting the following error when I try to run the powershell script generated by Azure Devops to config my deployment group. How do I fix this.
"The remote server returned an error: (407) Proxy Authentication Required."
It looks like you're behind an authenticating proxy. Powershell isn't great at handling them - some PS commands use the system proxy, some don't. There's several ways of working around it though if you search for that specific issue.
You could try this added to your script (just insert at the start of the script), which takes your current credential/proxy and passes it to the any web requests:
[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
These types of messages are not unique to anything with Azure. It's purely an environmental network issue, that you must implement in your code.
Similar posts have been asked here...
The remote server returned an error: (407) Proxy Authentication Required
... but they actually showed what their code looks like when making a request ...
myProxy.Credentials = NetworkCredential("user", "password", "domain");
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<bypasslist>
<clear />
</bypasslist>
<proxy proxyaddress="myproxy:9000"
usesystemdefault="false"
bypassonlocal="true"
autoDetect="False" />
</defaultProxy>
</system.net>
... whereas you are not. I point you back to the SO rules in my comment.
So, see that SO, to determine if anything in that thread helps you.
Checking the powershell script, you can find it calls .\config.cmd --deploymentgroup ....
So, you can edit it to specify proxy information:
./config.cmd --proxyurl xxx --proxyusername "myuser" --proxypassword "mypass" --deploymentgroup ...
More information: Run a self-hosted agent behind a web proxy
My coldfusion version is 10 and configured with iis. I have configured Rest service using the following code
<cfset restInitApplication(getDirectoryFromPath(getCurrentTemplatePath()), "myservicename") />
My cfc which is in same directory looks something like that
component restpath="test" rest="true" produces="application/json"
{
remote array function getResult(
required string tmpID restargsource="path",
string startDate restargsource="query",
string endDate restargsource="query"
)
httpmethod="GET"
restpath="{tmpID}"
{
return arguments.tmpID;
}
}
I am trying to access the rest service by url but it is giving me 404 not found error. Here is url which i have tried.
http://localhost:8500/rest/myservicename/test/10221
http://example.com/rest/myservicename/test/10221
http://127.0.0.1/rest/myservicename/test/10221
But all three is not working for me. When i try to refresh the service from coldfusion administrator, it is giving me following error.
Unable to refresh REST service.
Application myservicename could not be initialized.
Reason: The application does not contain any rest enabled CFCs.
The application does not contain any rest enabled CFCs.
I have save my cfc to webroot of iis and update the root path of rest service through coldfusion administrator. Then above error is gone and got the green message 'Server has been updated successfully'. But still not accessible through any url. Still getting 404 error. Can any one point me where i am doing wrong? Or help me to resolve this issue.
I am new to REST API. I am trying to convert web application to REST-ful with an updated site design.
My work environment on development server is Coldfusion10, Windows 2008 R2 Server.
So far I successfully registered REST services to web root directory of ColdFusion 10 server and it works fine.
However, I need to register REST services in the site's directory. I have done so and it worked couple of times but, most of the time I am receiving 500 error after I edit the CFC (changing string in cfreturn from "foo" to "foo2"). I verified syntax of the CFC by going directly via url and, its ok.
I tried to add REST services in Administrator and, most of the time I get errors when adding in Administrator like this:
•Unable to refresh REST service.
Application rc could not be initialized.
Reason: The application does not contain any rest enabled CFCs.
The application does not contain any rest enabled CFCs.
I added web services in the Application.cfc
<cfcomponent output="false">
<cfset this.name = hash(getCurrentTemplatePath()) />
<cfset this.applicationTimeout = createTimeSpan( 0, 0, 1, 0 ) />
<cffunction name="onRequestStart" access="public" returntype="boolean" output="false" hint="I initialize the request.">
<cfset restInitApplication("E:\flex\html\v4\rc","rc")>
<cfreturn true />
</cffunction>
</cfcomponent>
This is the /rc/studentHandler.cfc
<cfcomponent restpath="student" rest="true">
<cffunction name="getMethod" access="remote" output="false" returntype="string" httpmethod="get">
<cfreturn "foo">
</cffunction>
</cfcomponent>
And the last file is student.cfm. I call it from http://mydevip/v4/student.cfm
<cfhttp url="http://mydevip/rest/rc/student" method="get">
<cfoutput>#cfhttp.filecontent#</cfoutput>
I tried to call cfc directly from url which works if cfc in the CF web root folder http://mydevip/rest/rc/student and, gives me error if I call cfc in custom directory.
Here is the error from application.log
"Error","ajp-bio-8012-exec-5","11/13/13","10:13:30","5C89BF4E37081433800CEF0D961170B0","object is not an instance of declaring class The specific sequence of files included or processed is: E:\flex\html\v4\rc\studentHandler.cfc'' "
Thanks,
Gena
I'm using a Sitecore install with multiple sites. When linking from example1.com (/sitecore/content/example1) to an item under example2.com (/sitecore/content/example2/about)
Sitecore is not generating the link correctly for any cross-domain links. It is generating:
http://www.example1.com/example2/about.aspx
This is what is expected:
http://www.example2.com/about.aspx
The same thing happens from example2.com when linking to example1.com or any item under that site.
Both sites are defined in the web.config.
The rootNodes are both "/sitecore/content"
The start items are "/example1" and "/example2" respectively.
Rendering.SiteResolving is set to true
Rendering.SiteResolvingMatchCurrentSite is set to false
I'm using sc:link to generate the links.
Sitecore.Links.LinkProvider's alwaysIncludeServerUrl is set to true
If you are using hostName with wild cards (eg. "www.example1.com|example1.com"), you need to set targetHostName="www.example1.com" on your entry.
Even if you only have one domain, set targetHostName, as there is one thing/function that only looks at targetHostName. Eg. GetItemUrl() doesn't work as planned without a targetHostName and in 6.5.0 ver. 120706 it doesn't account for stuff set in the web.config. This is a bug and one they hopefully have fixed in future version. If you expirience the problem look here for a solution:
http://sitecorepm.wordpress.com/2010/08/04/using-cross-site-links-dynamic-links/
Have you set the hostName value of the <site> entry in web.config?
<site name="example1" hostName="www.example1.com" ... />
<site name="example2" hostName="www.example2.com" ... />
There's a very good blog post on this here: http://blog.paulgeorge.co.uk/2011/05/01/sitecore-linkmanager-inside-out-muti-site-and-sub-site-setups/ It looks like you've covered everything else required to make this work.
I've got my own box sitting in a rack. It's Win2000 running CF 7 and using the rack company's smtp server. I can't send emails. When I try, they simply go to the undeliverable email folder. Support says my server is sending a non-verifiable helo message. So their smtp server wont send it.
It being CF 7, the admin has nowhere to specify U/P for auth. However I SHOULD be able to do that within the tag. When I do, I get no errors but the mail goes to the undeliverable folder.
CODE:
<cftry>
<cfmail to="jxxx#yahoo.com"
from="jxxx#xxx.com"
subject="xxx.com Sign-up"
server="smtp.xxx.net"
port="25"
username="valid-account#xxx.net"
password="password" >
This is a test - with server specified
</cfmail>
Success w/ server user defined
<cfcatch type="any">
<strong>ERROR: #cfcatch.Message#</strong><BR />
#cfcatch.Detail#
</cfcatch>
</cftry>
<cftry>
<cfmail to="jxxx#yahoo.com"
from="xxx#xxx.net"
subject="xxx.com Sign-up" >
This is a test - without server specified
</cfmail>
Success w/o server user defined
<cfcatch type="any">
<strong>ERROR: #cfcatch.Message#</strong><BR />
#cfcatch.Detail#
</cfcatch>
</cftry>
I don't know much about mail servers...
Any ideas?
This could be an issue with DNS and the inability of the receiving system to either do a reverse DNS lookup or maybe it isn't in DNS at all.
another possibility is that non-verifable Helo means that you don't have FQDN associated with the system (perhaps your system name does not have a domain associated with it?) (ie. helo me) probably going to be bounced versus "helo me.somewhere.com".
so - don't think this a CF issue from a coding perspective - something that is related to your system setting (FQDN perhaps) or DNS in your location. Most anti-spam / anti-open relay settings are going to look at DNS for some level of validation.