• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF 2021 and REST web service, getting 500 Remotely

Community Beginner ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

I have a REST web service that I have been using on CF 2016 and CF 2021 servers without issue for a long time now.  I have just recently upgraded to CF 2021, and I am getting a weird behavior that I can not identify what is happening.  

 

From the sderver, if I open a URL to the REST site, it works just as expected, but if I try from any other machine, I get an error 500.  I tried with calling the CFC directly, and same behavior.  

 

Here is the start of the component:

<cfcomponent rest="true" restpath="/IVR">

    <cffunction name="GetPolicyInfo" access="remote" httpmethod="GET" restPath="GetPolicyInfo/{RequestId}/{PolicyNumber}/{ZipCode}" returntype="any" produces="application/json">
        <cfargument name="RequestId" type="String" required="true" restargsource="PATH" />
        <cfargument name="PolicyNumber" type="String" required="true" restargsource="PATH" />
        <cfargument name="ZipCode" type="String" required="true" restargsource="PATH" />
... the rest is the implemenation of the code, all of which is wrapped in a TRY/CATCH block ....
 
A sample call would be:
A sample direct CFC call would be:
https://company.com/TEST/webservices/rest/IVR.cfc?method=GetPolicyInfo&RequestId=11111&PolicyNumber=...

In both calls, I am able to successfully make the call from the an RDP session directly on the server, and it returns back the expected result, but in both cases I get an ERROR 500 with no details if I try to call it from any place else.  
 
The REST mapping is setup with:
Root Path: (directory to where the files are)\test\webservices\REST
Service Mapping: TEST

My first guess is something with the ACCESS value, but it is remote, as it should be with this so I am not sure why I would have issues with access form any other machine.  

The server was setup with the installer's deafult secure profile.  Is there something in that setup or option someplace that would limit/restrict access to the REST webservices on the server?  I have other non-REST web services on the server that run without any issues.  This is the only REST webservice that I have on this server, so I do not really have any other ones to test and verify against.  
 
Developer Profile is currently disabled.  I did enable it, and go into the REST Playground and was able to make the calls to the web service from the server while directly RDP'ed on it (access to CF admin is restricted to the local server only).  
 
In REST Services, the "Update REST Path" has a value of "rest".  I have removed and readded the REST service in CF Admin.  
 
The application.cfm file is not in the REST folder, it is in the WebSErvices folder and applied for all the web services, so there is nothing REST specific in it. 
 
This is a Windows based server, running ColdFusion 2021 Enterprise edition with Update 4 applied and Java 11.0.15.1.  
 
I am open to suggestions.  As this is a production web server, there are limits what can be done during normal operating hours
 
Matthew

Views

416

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Aug 03, 2022 Aug 03, 2022

Matthew, first and foremost, let's see what the 500 error is. If indeed cf is generating it, see the coldfusion application.log (and exception.log) to see what it is, and tell us.

 

If you may find there IS no error, then I'd propose a sanity check. If you go to the command line on the server and your local machine and do a ping of the domain name in your url. Is the reported ip address for them the same? If not identical, do you feel both point to the server in question? You may find the local

...

Votes

Translate

Translate
Community Beginner , Aug 03, 2022 Aug 03, 2022

Sorry, this was my fault.  

 

I just could not understand the different behavior between calling the URL locally and from another machine.  I was not getting any output in application log or any toher ColdFusion log.  

 

After commenting out every line fo code in the template and slowing walking back until I reached the error I found that it was some weird behavior in another template that was unexpected but I was able to resolve.  

 

Sorry to have wasted your time, thank you for helping regardless.  

...

Votes

Translate

Translate
Community Beginner ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

The first line was supposed to be:

I have a REST web service that I have been using on CF 2016 and CF 2018 servers without issue for a long time now....

 

I have the code running on 2016 and 2018 servers and are just now trying to get it running on a 2021 server.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Matthew, first and foremost, let's see what the 500 error is. If indeed cf is generating it, see the coldfusion application.log (and exception.log) to see what it is, and tell us.

 

If you may find there IS no error, then I'd propose a sanity check. If you go to the command line on the server and your local machine and do a ping of the domain name in your url. Is the reported ip address for them the same? If not identical, do you feel both point to the server in question? You may find the local machine has a hosts file that points the domain to your own local machine.

 

If the above proves not to be the case, confirm also that you see the 500 error registered in the iis request log.

 

Also, would you affirm that the cf2016 and 2018 that "work" are on another machine? I only point this out as it could be that if they ran in this machine, you might experience the problem with them. 

 

And to be clear, no, nothing about the secure profile or developer profiles should affect how the rest feature works, as far as I know. 

 

One other thing, the case of things is above is varying, While IIS should not care, some aspects of CF may. Have you considered making everything lowercase, as another sanity check? Do beware that if you make some changes about the rest configuration, you may need to restart cf for them to take effect.

 

I realize these thoughts are not necessarily the answer to or confirmation of what you may fear to really be the problem, but it's key to at least make sure we are chasing the right ghost first. 🙂 And I hope my first suggestion may be the key to that. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Sorry, this was my fault.  

 

I just could not understand the different behavior between calling the URL locally and from another machine.  I was not getting any output in application log or any toher ColdFusion log.  

 

After commenting out every line fo code in the template and slowing walking back until I reached the error I found that it was some weird behavior in another template that was unexpected but I was able to resolve.  

 

Sorry to have wasted your time, thank you for helping regardless.  

 

Matt

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

LATEST

Thanks, but please do be sure to take note of that first suggestion I'd made. If you'd have looked to the applicaiton.log, you should have been able to very readily see the error (which you ultimately solved via your manual code tweaking). 

 

It is indeed important to remember this for REST request errors, as generally most have no error handling catching and returning errors as json, so they just see a 500 error like you did. As such, the logs are the easiest way to find what's a miss, like you ultimately discovered.


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation