Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
BlueDragon Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 357
Product BlueDragon
Category Web Services
Question Can a CFC be invoked from an ASP.NET web service?
Answer Yes it can. Your web service project will need to have references to the BlueDragon and BlueDragon.Controls DLLs. Here's an example of an ASP.NET web service calling a CFC. This example was tested with BD.NET 7.0.1 beta1.

using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;

using com.naryx.tagfusion.cfm.engine;
using com.newatlanta.NET.servlet.http;
using NewAtlanta.BlueDragon;

namespace WebService1
{
    /// 
    /// Summary description for Service1
    /// 
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            cfSession cfmSession = new cfSession(
                new JSharpHttpServletRequest(Context, CfmHttpHandler.getServletContext()),
                new JSharpHttpServletResponse(Context.Response),
                cfEngine.thisServletContext);

            CfComponent cfc = new CfComponent(cfmSession, "hello", Context.Response.Output);
            string text = (string)cfc.Invoke("sayHello");

            return "Output from hello.sayHello() = " + text;
        }
    }
}



   
company media information terms of use privacy policy contact us