Loading ...
Sorry, an error occurred while loading the content.

Re: [fusebox5] Application.cfc and webservices

Expand Messages
  • Sean Corfield
    ... I just tried this with a clean skeleton app from FB 5.5.1 and added a CFC to the model with a remote method and it worked perfectly. I suspect you have
    Message 1 of 9 , Mar 20, 2008
    • 0 Attachment
      On Mar 20, 2008, at 7:05 AM, aliaspooryorik wrote:
      > I am using an Application.cfc for my Fusebox 5.5.1 web app which
      > extends fusebox5.Application. When I try to call a cfc as a webservice
      > (access="remote"), it fails on line 32 of Fusebox.Application.cfc with
      > the message

      I just tried this with a clean skeleton app from FB 5.5.1 and added a
      CFC to the model with a remote method and it worked perfectly.

      I suspect you have something in your Application.cfc that does not
      play well with Fusebox. Please post your entire Application.cfc for
      us to look at.

      Things to check:

      1. Your application name - <cfset this.name = ... /> - must not use
      the old method of setting a unique name from early Fusebox 5.x
      skeletons. It should be:

      <cfset this.name = right(REReplace(getDirectoryFromPath
      (getCurrentTemplatePath()),'[^A-Za-z]','','all'),64) />

      or a fixed application name. There was a bug fix (about four months
      ago - so it's not in FB55 but it is in the new FB551 release) that
      addressed remote calls:

      http://trac.fuseboxframework.org/fusebox/ticket/304

      2. Any onXyz() handlers in your Application.cfc *MUST* call
      super.onXyz() so that Fusebox's handlers are executed.

      > In case anyone else is trying to do this then you also need to add
      > this to the onRequestStart of your Application.cfc:

      No, you don't Fusebox handles this automatically - as long as you
      call super.onRequestStart(argumentCollection=arguments) inside your
      onRequestStart() handler (per the instructions in the skeleton
      Application.cfc).

      For reference, here's the Fusebox 5.5.1 skeleton Application.cfc:

      <cfcomponent extends="fusebox5.Application" output="false">
      <!---
      sample Application.cfc for ColdFusion MX 7 and later compatible
      systems
      --->

      <!--- set application name based on the directory path --->
      <cfset this.name = right(REReplace(getDirectoryFromPath
      (getCurrentTemplatePath()),'[^A-Za-z]','','all'),64) />

      <!--- enable debugging --->
      <cfset FUSEBOX_PARAMETERS.debug = true />

      <!--- force the directory in which we start to ensure CFC
      initialization works: --->
      <cfset FUSEBOX_CALLER_PATH = getDirectoryFromPath
      (getCurrentTemplatePath()) />

      <!---
      if you define any onXxxYyy() handler methods, remember to start by
      calling
      super.onXxxYyy(argumentCollection=arguments)
      so that Fusebox's own methods are executed before yours
      --->

      </cfcomponent>

      Sean A Corfield -- (904) 302-SEAN
      An Architect's View -- http://corfield.org/

      "If you're not annoying somebody, you're not really alive."
      -- Margaret Atwood
    • aliaspooryorik
      Sean - you re right as always! I was setting This.name as because
      Message 2 of 9 , Mar 20, 2008
      • 0 Attachment
        Sean - you're right as always! I was setting This.name as

        <cfset This.name = Hash(getDirectoryFromPath(getCurrentTemplatePath())
        & CGI.SERVER_NAME) />

        because I wanted to use the same scripts to power multiple websites
        with separate application scopes.

        I did spot that Fusebox handled the onRequest issue after I'd posted -
        sorry for the confusion.

        Thanks for your help,

        - John


        --- In fusebox5@yahoogroups.com, Sean Corfield <seanc@...> wrote:
        >
        > On Mar 20, 2008, at 7:05 AM, aliaspooryorik wrote:
        > > I am using an Application.cfc for my Fusebox 5.5.1 web app which
        > > extends fusebox5.Application. When I try to call a cfc as a webservice
        > > (access="remote"), it fails on line 32 of Fusebox.Application.cfc with
        > > the message
        >
        > I just tried this with a clean skeleton app from FB 5.5.1 and added a
        > CFC to the model with a remote method and it worked perfectly.
        >
        > I suspect you have something in your Application.cfc that does not
        > play well with Fusebox. Please post your entire Application.cfc for
        > us to look at.
        >
        > Things to check:
        >
        > 1. Your application name - <cfset this.name = ... /> - must not use
        > the old method of setting a unique name from early Fusebox 5.x
        > skeletons. It should be:
        >
        > <cfset this.name = right(REReplace(getDirectoryFromPath
        > (getCurrentTemplatePath()),'[^A-Za-z]','','all'),64) />
        >
        > or a fixed application name. There was a bug fix (about four months
        > ago - so it's not in FB55 but it is in the new FB551 release) that
        > addressed remote calls:
        >
        > http://trac.fuseboxframework.org/fusebox/ticket/304
        >
        > 2. Any onXyz() handlers in your Application.cfc *MUST* call
        > super.onXyz() so that Fusebox's handlers are executed.
        >
        > > In case anyone else is trying to do this then you also need to add
        > > this to the onRequestStart of your Application.cfc:
        >
        > No, you don't Fusebox handles this automatically - as long as you
        > call super.onRequestStart(argumentCollection=arguments) inside your
        > onRequestStart() handler (per the instructions in the skeleton
        > Application.cfc).
        >
        > For reference, here's the Fusebox 5.5.1 skeleton Application.cfc:
        >
        > <cfcomponent extends="fusebox5.Application" output="false">
        > <!---
        > sample Application.cfc for ColdFusion MX 7 and later compatible
        > systems
        > --->
        >
        > <!--- set application name based on the directory path --->
        > <cfset this.name = right(REReplace(getDirectoryFromPath
        > (getCurrentTemplatePath()),'[^A-Za-z]','','all'),64) />
        >
        > <!--- enable debugging --->
        > <cfset FUSEBOX_PARAMETERS.debug = true />
        >
        > <!--- force the directory in which we start to ensure CFC
        > initialization works: --->
        > <cfset FUSEBOX_CALLER_PATH = getDirectoryFromPath
        > (getCurrentTemplatePath()) />
        >
        > <!---
        > if you define any onXxxYyy() handler methods, remember to start by
        > calling
        > super.onXxxYyy(argumentCollection=arguments)
        > so that Fusebox's own methods are executed before yours
        > --->
        >
        > </cfcomponent>
        >
        > Sean A Corfield -- (904) 302-SEAN
        > An Architect's View -- http://corfield.org/
        >
        > "If you're not annoying somebody, you're not really alive."
        > -- Margaret Atwood
        >
      • aliaspooryorik
        Hi Sean, Sorry, but I m still having an issue. I ve just tried downloading the sample noxml application from the fusebox site and also the core files (5.5.1)
        Message 3 of 9 , Mar 20, 2008
        • 0 Attachment
          Hi Sean,

          Sorry, but I'm still having an issue. I've just tried downloading the
          sample noxml application from the fusebox site and also the core files
          (5.5.1) and ran it as is. It ran as expected. I then created a cfc
          called foo.cfc in the webroot with the following code:

          <cfcomponent>
          <cffunction name="myFunction" access="remote" returntype="any"
          output="false">
          <cfargument name="myArgument" type="string" required="yes">
          <cfset myResult="foo">
          <cfreturn myResult>
          </cffunction>
          </cfcomponent>

          When I call foo.cfc?wsdl I get the error:

          Variable FORM is undefined.

          The error occurred in D:\Inetpub\wwwroot\fusebox5\Application.cfc: line 32

          Thanks,

          - John

          --- In fusebox5@yahoogroups.com, Sean Corfield <seanc@...> wrote:
          >
          > On Mar 20, 2008, at 7:05 AM, aliaspooryorik wrote:
          > > I am using an Application.cfc for my Fusebox 5.5.1 web app which
          > > extends fusebox5.Application. When I try to call a cfc as a webservice
          > > (access="remote"), it fails on line 32 of Fusebox.Application.cfc with
          > > the message
          >
          > I just tried this with a clean skeleton app from FB 5.5.1 and added a
          > CFC to the model with a remote method and it worked perfectly.
          >
          > I suspect you have something in your Application.cfc that does not
          > play well with Fusebox. Please post your entire Application.cfc for
          > us to look at.
          >
          > Things to check:
          >
          > 1. Your application name - <cfset this.name = ... /> - must not use
          > the old method of setting a unique name from early Fusebox 5.x
          > skeletons. It should be:
          >
          > <cfset this.name = right(REReplace(getDirectoryFromPath
          > (getCurrentTemplatePath()),'[^A-Za-z]','','all'),64) />
          >
          > or a fixed application name. There was a bug fix (about four months
          > ago - so it's not in FB55 but it is in the new FB551 release) that
          > addressed remote calls:
          >
          > http://trac.fuseboxframework.org/fusebox/ticket/304
          >
          > 2. Any onXyz() handlers in your Application.cfc *MUST* call
          > super.onXyz() so that Fusebox's handlers are executed.
          >
          > > In case anyone else is trying to do this then you also need to add
          > > this to the onRequestStart of your Application.cfc:
          >
          > No, you don't Fusebox handles this automatically - as long as you
          > call super.onRequestStart(argumentCollection=arguments) inside your
          > onRequestStart() handler (per the instructions in the skeleton
          > Application.cfc).
          >
          > For reference, here's the Fusebox 5.5.1 skeleton Application.cfc:
          >
          > <cfcomponent extends="fusebox5.Application" output="false">
          > <!---
          > sample Application.cfc for ColdFusion MX 7 and later compatible
          > systems
          > --->
          >
          > <!--- set application name based on the directory path --->
          > <cfset this.name = right(REReplace(getDirectoryFromPath
          > (getCurrentTemplatePath()),'[^A-Za-z]','','all'),64) />
          >
          > <!--- enable debugging --->
          > <cfset FUSEBOX_PARAMETERS.debug = true />
          >
          > <!--- force the directory in which we start to ensure CFC
          > initialization works: --->
          > <cfset FUSEBOX_CALLER_PATH = getDirectoryFromPath
          > (getCurrentTemplatePath()) />
          >
          > <!---
          > if you define any onXxxYyy() handler methods, remember to start by
          > calling
          > super.onXxxYyy(argumentCollection=arguments)
          > so that Fusebox's own methods are executed before yours
          > --->
          >
          > </cfcomponent>
          >
          > Sean A Corfield -- (904) 302-SEAN
          > An Architect's View -- http://corfield.org/
          >
          > "If you're not annoying somebody, you're not really alive."
          > -- Margaret Atwood
          >
        • Sean Corfield
          ... I m not sure about your file structure... If you download the skeleton and unzip it into the webroot your get: wwwroot skeleton noxml If you put foo.cfc
          Message 4 of 9 , Mar 20, 2008
          • 0 Attachment
            On Mar 20, 2008, at 9:34 AM, aliaspooryorik wrote:
            > I've just tried downloading the
            > sample noxml application from the fusebox site and also the core files
            > (5.5.1) and ran it as is. It ran as expected. I then created a cfc
            > called foo.cfc in the webroot with the following code:

            I'm not sure about your file structure... If you download the
            skeleton and unzip it into the webroot your get:

            wwwroot\
            skeleton\
            noxml\

            If you put foo.cfc in the webroot:

            wwwroot\
            foo.cfc

            Then it is not using the noxml\ Application.cfc - it will use
            whatever you have in your webroot.

            Sean A Corfield -- (904) 302-SEAN
            An Architect's View -- http://corfield.org/

            "If you're not annoying somebody, you're not really alive."
            -- Margaret Atwood
          • aliaspooryorik
            Hi Sean, I appreciate your input. I apologise for not explaining myself very well. My Directory structure for the app is: wwwroot/noxml/Application.cfc
            Message 5 of 9 , Mar 20, 2008
            • 0 Attachment
              Hi Sean,

              I appreciate your input. I apologise for not explaining myself very well.

              My Directory structure for the app is:

              wwwroot/noxml/Application.cfc
              wwwroot/noxml/foo.cfc
              wwwroot/noxml/index.cfm
              wwwroot/noxml/... (model/view/controller etc)


              My Directory structure for the core files is:

              wwwroot/Fusebox5/Application.cfc
              wwwroot/Fusebox5/...

              So the url to call the CFC is http://localhost/noxml/foo.cfc?wsdl

              I'm running on CF8 & IIS5. I did try restarting the CF service to make
              sure the application scope initialised properly.

              - John


              --- In fusebox5@yahoogroups.com, Sean Corfield <seanc@...> wrote:
              > I'm not sure about your file structure... If you download the
              > skeleton and unzip it into the webroot your get:
              >
              > wwwroot\
              > skeleton\
              > noxml\
              >
              > If you put foo.cfc in the webroot:
              >
              > wwwroot\
              > foo.cfc
              >
              > Then it is not using the noxml\ Application.cfc - it will use
              > whatever you have in your webroot.
              >
              > Sean A Corfield -- (904) 302-SEAN
              > An Architect's View -- http://corfield.org/
              >
              > "If you're not annoying somebody, you're not really alive."
              > -- Margaret Atwood
              >
            • Sean Corfield
              ... Ah, got it. My test case wasn t quite right. Hmm... OK, I see another scenario where this bug can be triggered too. Ugh! I ll open a ticket and fix it in
              Message 6 of 9 , Mar 20, 2008
              • 0 Attachment
                On Mar 20, 2008, at 10:40 AM, aliaspooryorik wrote:
                > My Directory structure for the app is:

                Ah, got it. My test case wasn't quite right. Hmm... OK, I see another
                scenario where this bug can be triggered too. Ugh! I'll open a ticket
                and fix it in SVN in the next day or two.

                Sean A Corfield -- (904) 302-SEAN
                An Architect's View -- http://corfield.org/

                "If you're not annoying somebody, you're not really alive."
                -- Margaret Atwood
              • Sean Corfield
                ... Ticket #330. Fixed in SVN. Download the latest trunk/corefiles/ Application.cfc file and it should solve your problem. Thanx for finding that! Sean A
                Message 7 of 9 , Mar 20, 2008
                • 0 Attachment
                  On Mar 20, 2008, at 11:03 AM, Sean Corfield wrote:
                  > Ah, got it. My test case wasn't quite right. Hmm... OK, I see another
                  > scenario where this bug can be triggered too. Ugh! I'll open a ticket
                  > and fix it in SVN in the next day or two.

                  Ticket #330. Fixed in SVN. Download the latest trunk/corefiles/
                  Application.cfc file and it should solve your problem.

                  Thanx for finding that!

                  Sean A Corfield -- (904) 302-SEAN
                  An Architect's View -- http://corfield.org/

                  "If you're not annoying somebody, you're not really alive."
                  -- Margaret Atwood
                • aliaspooryorik
                  Thanks for fixing it! - John Whish
                  Message 8 of 9 , Mar 21, 2008
                  • 0 Attachment
                    Thanks for fixing it!

                    - John Whish

                    --- In fusebox5@yahoogroups.com, Sean Corfield <seanc@...> wrote:
                    >
                    > On Mar 20, 2008, at 11:03 AM, Sean Corfield wrote:
                    > > Ah, got it. My test case wasn't quite right. Hmm... OK, I see another
                    > > scenario where this bug can be triggered too. Ugh! I'll open a ticket
                    > > and fix it in SVN in the next day or two.
                    >
                    > Ticket #330. Fixed in SVN. Download the latest trunk/corefiles/
                    > Application.cfc file and it should solve your problem.
                    >
                    > Thanx for finding that!
                    >
                    > Sean A Corfield -- (904) 302-SEAN
                    > An Architect's View -- http://corfield.org/
                    >
                    > "If you're not annoying somebody, you're not really alive."
                    > -- Margaret Atwood
                    >
                  Your message has been successfully submitted and would be delivered to recipients shortly.