Coldfusion RESTful API, No Mapping Found error

546 Views Asked by At

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!

0

There are 0 best solutions below