1

This shouldn't be too hard to answer, but the discussions and documentation I've found can be rather unclear.

First of all, a little bit of information about my setup:

I'm on a hosted environment, and going through our ColdFusion admin group can be time-consuming. Therefore, I'm using the restInitApplication function to register my RESTful web service.

My webroot folder (where my Application.cfm is located) is in "E:\docs\wwwroot". I can only see, add, edit folders/files from wwwroot down. I have no idea what's in "e:\docs". I believe that up above where I cannot see there is another Application.cfm that sets such things as the serverType (development, staging, or production), that we (and other ColdFusion sites hosted on this server) use in various places in our application code.

My pdfRestfulAPI.cfc (the component containing my webservice function) is in this folder, "e:\docs\wwwroot\RESTservices". My component code looks like this:

<cfcomponent rest="true"   > 
    <cffunction name="pdfconvert" access="remote" returntype="binary" 
           output="false"  produces="application/xml" method="get" >  

        <cfargument name="sourceWebPageURL" type="string" > 
            <cfset pdfDoc = "" >  
            <cfdocument name="pdfDoc" 
                  format="PDF" 
                  src="#sourceWebPageURL#" 
                  saveAsName="sample.pdf" >
            </cfdocument>  
            <cfreturn #pdfDoc#>
    </cffunction>
</cfcomponent>

The function itself is not an issue. It just converts a web page to pdf--pass a URL, get a PDF version of that web page. When I set it up as non-RESTful API (SOAP/xml) it works just fine.

In my Application.cfm, I am attempting to register my web service using the following code:

<cfset restInitApplication( getDirectoryFromPath(getCurrentTemplatePath()) 
              & "RESTservices" ) >

This gives me a dir_path attribute of "E:\docs\wwwroot\RESTservices", which seems correct to me. I've omitted the optional mapping_name attribute. When the documentation says that this "can be anything", that is not helpful.

The error that I get in my Application.cfm reads:

coldfusion.rest.RestAppAdapter$InvalidApplicationException: No mapping found for path E:\docs\wwwroot\RESTservices

Hopefully, I've laid out the details in such a way that anyone could try this out and let me know what I'm doing wrong.

Thanks, everyone!

Leigh
  • 28,765
  • 10
  • 55
  • 103
  • Which CF version are you using? – Pankaj Jan 12 '15 at 16:55
  • @Pankaj: ColdFusion 10 – octopusCrime Jan 12 '15 at 17:17
  • @Pankaj: To be more precise, dumping the "Server" scope gives me the following productversion: 10,0,12,286680 – octopusCrime Jan 12 '15 at 17:57
  • @James A Mohler - I don't see where you edited this post. Did you have a suggestion? – octopusCrime Jan 12 '15 at 21:15
  • I added that this was a question about `application.cfm` – James A Mohler Jan 12 '15 at 23:17
  • 1
    You may need to provide that optional mapping name in your restinitApplication function. This is an optional fied, if there is an Applicaiton.cfc file present in the directory. In which case the Application name would be used to identify the REST services in the directory. Because you are using Application.cfm, that can be the reason or it may be possible that you have not used any name for your test application at all. Just my guess..... – CFML_Developer Jan 13 '15 at 06:25
  • Can you post the relevant code from your Application.cfm. Also... why are you using Application.cfm (which is basically obsolete technology) rather than Application.cfc? I'd also try providing the mapping value, given its absence is what the error is complaining about. – Adam Cameron Jan 13 '15 at 06:47
  • Read this blog http://blogs.coldfusion.com/post.cfm/getting-started-with-rest-in-coldfusion-10 I am sure this will fix your problem :-) – Pankaj Jan 13 '15 at 08:48
  • @CFML_Developer: I have tried the optional mapping name. Since it can be "anything", I tried the folder where my REST cfc is located, the application name as set in the cfapplication tag, and some totally new value. Result: "Unsupported Operation". The code from Application.cfm is hard to miss, it's just one line, already posted. As for why we still use Application.cfm instead of cfc: I'm the new guy on the team, and the veterans are really touchy about changing anything related to Application.cfm, due to a major disaster last year, not caused by me :) – octopusCrime Jan 13 '15 at 14:32
  • @Pankaj: I've already read that blogpost, and probably any other that anyone would like to suggest. I gave up on blogposts, that's why I'm here. I tried to provide enough of my code that someone could actually try it for themselves.... – octopusCrime Jan 13 '15 at 14:46

0 Answers0