Categories

Partners
  • Website Templates

  • Design Feeds

  • Adobe Photoshop Tutorials

  • Website Templates, WordPress Themes

  • Website Templates

  • Flash Web Sites

  • Photoshop Templates

  • Photo Contests

  • Photo Tips
  • Search


    Advanced Search


    Partner Links
  • Adobe Photoshop Tutorials

  • Free Stock Photos and Images



  • Website Templates

     »  Home  »  Macromedia Products  »  Macromedia ColdFusion MX  »  Standard
    Standard
    (Page 1 of 3)   « Back | 1 | 2 | 3 | Next »



    » ColdFusion MX Overview - The Wrap Up
    Published 05/19/2006 | Standard , Enterprise |
     Page 12 — The Wrap Up

    I think ColdFusion MX should raise some eyebrows in the Web development community. Macromedia has done a fantastic job of bridging the ease of use of ColdFusion with the sheer power of the Java platform. In CFMX, we get a toolset made for today's problems that's easy enough for beginner CF coders to learn, yet flexible enough for advanced Java coders. There are many more features to explore, like Perl-Compatible Regular Expressions, built-in Unicode for international applications, and new charting features. I recommend you delve deeper into components.

    There are many many cool things I couldn't get to because they are beyond the scope of this article. So, be an intrepid individual and check out the online documentation for Developing ColdFusion MX Applications with CFML or the ColdFusionMX Development Center for more information and tutorials on the wealth of other new features and improvements.

    And how time flies! You're now a black belt CFMX monkey! I hope I have handed you the orange wrench in all its glory and sent you fast on your way to creating the next big thing. Just don't forget about me when you're a celebrity.

    » ColdFusion MX Overview - ColdFusion MX's Evil Twin?
    Published 05/19/2006 | Standard , Enterprise |
    Page 11 — ColdFusion MX's Evil Twin?

    One thing that took me by complete surprise during the creation of this article was the discovery of a product called BlueDragon, made by New Atlanta Communications. The BlueDragon product is a competing CFML Java-powered Web application server, just like the real CFMX. With its lower base price ($249/server), the product states that it supports a major subset of the CFML 5.0 syntax with slight variations outlined in its documentation. They plan to upgrade their syntax to be just as close to the CFML of ColdFusion MX as they can get it. They state that the real distinction is in BlueDragon's ability to deploy CFML pages as compiled binaries without revealing any CFML source code. With BlueDragon, you can package your entire application into a standard J2EE WAR or EAR file for deployment to BEA WebLogic or IBM WebSphere without having to buy and install extra software — something one of the BlueDragon developers tells me Macromedia CFMX will not support.

    I didn't spend that much time with the free BlueDragon evaluation, but I was amazed at how similar the tags and administrative screens were to that of the real Macromedia ColdFusion.

    » ColdFusion MX Overview - XML, Java, and Flash in CFMX
    Published 05/19/2006 | Standard , Enterprise |

    Page 10 — XML, Java, and Flash in CFMX


    If you've ever had to create, parse, or transform XML documents other than WDDX in ColdFusion 5, kudos to you for figuring it out! The way I used to do it was with Microsoft's XML Services COM object. If you haven't ever used it from within ColdFusion before, I'll ruin the surprise — it sucked. It got the job done, but it was nasty from within CF5. ColdFusion MX now has native XML support for your XML documents. Once you start working with XML in CFMX, you'll want to lean back and sip on a Piña Colada!

    There's a new XMLPARSE() function that takes a string of valid XML and turns it into something like a ColdFusion structure. You also get an XMLSEARCH() function that allows you to query an XML file with XPATH. Finally, there's the new <CFXML>tag for creating new XML documents. Check out this Macromedia tutorial on native XML handling in CFMX.

    Java

    Since CFML is getting converted to Java in CFMX, there are suddenly tons of interesting ways to use Java in your applications. For example, you can now use JSP custom tags just like you would use ColdFusion tags in your CFML code. Now that's interesting, very interesting. Moouahaha! Java folk will drool at the ways in which you can use Java APIs, JavaBeans, EJBs, Servlets and even gain access to your CFML page's underlying PageContext object. Check out Macromedia's article on Using Java and J2EE elements in ColdFusion MX Applications for more information.

    Flash Integration

    In ColdFusion 5, Flash wasn't really "integrated" with ColdFusion Server very much at all. There were some limited things you could do to make a dynamic Flash movie, but anybody could do it with or without ColdFusion Server. In CFMX, Flash clients can actually dial in to your ColdFusion Components on your server as if they were part of the Flash movie itself. Even if the component in question happens to be on the other end of the Internet, it doesn't matter.

    This is quite a cool concept. It provides a way for a Flash movie to talk to the server without the page reloading. They call this a "rich client" system, meaning the Flash movie isn't just a novelty object with a finite amount of tricks up its sleeve. Old school Flash movies would simply sit on your Web page and were basically limited to what was there when the page loaded. Now, you can create a full-blown application with no real need of the concept of going to a different Web page. For example, you can have a Flash movie that runs queries and pulls up the details of different products in a store on a single page.

    Hey, if you don't need to reload, then what do you need a browser for in the first place? Wouldn't Macromedia love to own a market where developers create ColdFusion-powered Flash applications that don't use Web browsers? After all, Flash is a better looking front end for the user and it doesn't require a Web browser.

    Nevertheless, I doubt this concept will ever fly seeing how the Flash authoring environment is not entirely text based and is still hard for coders to get used to. If Macromedia creates a new version of the Flash authoring environment that is text-oriented, I think coders will really start to take notice and Flash will get a lot of traction as an approachable rich client Internet application platform. I think ActionScript is a step in the right direction, but not the leap it needs to be in order to hook the masses. Until then, I'm anticipating that there will only be a trickle of rich Flash applications at big brand name product sites, seeing how there aren't very many stellar Flash designers who wield code like the pros. Of course, as Dennis Miller always says, "That's my opinion and I could be wrong."

    » ColdFusion MX Overview - Consuming Web Services
    Published 05/19/2006 | Standard , Enterprise |

    In our last segment, we created a Web service that anybody can use no matter which programming language they are using to call it. All we need to provide them with is our WSDL link, http://127.0.0.1:8500/dateExample.cfc?WSDL.

    Lets now see what it's like to use somebody else's Web service in our own code. To test the waters, head over to xmethods.net, which has a nice selection of Web services for us to try out. For this example, lets click on the service named "Delayed Stock Quote". On its page, we see the delayed stock quote WSDL link. Remember what that does?

    Look towards the bottom of the "Delayed Stock Quote" service page at the section labeled "Usage Notes." You'll see that this Web service accepts a "symbol" argument, and returns a number (a float). If you use Dreamweaver MX, you can enter this WSDL link into its web services palette, and Dreamweaver will automatically register it and understand it. Check it out.

    Macromedia ColdFusion web Services Palette DWMX

    If you click on the line that says "float getQuote", you can drag and drop it into your code pane on the right side. When you drag and drop it, the following <CFINVOKE> statement appears:

    <CFINVOKE
     WEBSERVICE="http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"
     METHOD="getQuote"
     RETURNVARIABLE="aQuote">
     <CFINVOKEARGUMENT name="symbol" value="enter_value_here"/>
    </CFINVOKE>

    You should recognize <CFINVOKE> from earlier, but instead of a COMPONENT attribute, we use a WEBSERVICE attribute. With a little tweaking, we'll create a page that tells us the current price for Macromedia stock.

    showStockPrice.cfm

    <CFINVOKE
     WEBSERVICE="http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"
     METHOD="getQuote"
     RETURNVARIABLE="aQuote">
     <CFINVOKEARGUMENT name="symbol" value="MACR"/>
    </CFINVOKE>

    Macromedia is currently at <CFOUTPUT>#aQuote#</CFOUTPUT>.

    One thing you can do to make life easier with ColdFusion Web services is register Web services in the ColdFusion Administrator. That way, you can give a Web service a name like "stockGrabber", and refer to it by that name, instead of a long WSDL path that could potentially change and require you to go through many pages for updating.

    Log in to your ColdFusion Administrator (typically located at http://127.0.0.1:8500/cfide/administrator/index.cfm). Within the left navigation, there is a new CFMX link called "Web Services" that you should click on. Type in a name that you would like to use for this Web service. Lets call it "stockGrabber". Paste our stock-grabbing WSDL link into the field labeled "WSDL URL". Finally, click "Update Web Service".

    Now that it's registered, we can call the Web service again, this time by name. For example,

    showStockPrice.cfm

    <CFINVOKE
     WEBSERVICE="stockGrabber"
     METHOD="getQuote"
     RETURNVARIABLE="aQuote">
     <CFINVOKEARGUMENT name="symbol" value="MACR"/>
    </CFINVOKE>

    Macromedia is currently at <CFOUTPUT>#aQuote#</CFOUTPUT>.

    I expect more and more exciting Web services to start popping up all over the place. As a matter of fact, I just read that Google started Google Web APIs where you can query the Google system via Web services.

    You might also check out the Web services sites at IBM and Microsoft, or the site webservices.org, which covers many topics related to Web services.

    » ColdFusion MX Overview - Functionality as a Web Service
    Published 05/19/2006 | Standard , Enterprise |

    First, we'll need to go back into our .cfc file and let ColdFusion know that we plan on exposing the component as a Web service. We only need to specify that the <CFFUNCTION>s can be accessed remotely as a Web service and that the type of information returned by each <CFFUNCTION> is a "string". We'll set the ACCESS attribute of each <CFFUNCTION> to "remote" (meaning Web service) and the RETURNTYPE attribute to "string". If we wanted to be really spiffy, we would also add the OUTPUT="FALSE" attribute to the <CFFUNCTION> tags. It's good practice, because it causes the body of the function to execute as though it were in a <CFSILENT> tag.

    Here's what our .cfc file looks like now:

    dateExample.cfc

    <CFCOMPONENT HINT="This component is used to perform very
    simple date manipulation. It can tell you the name of the current
    day, what yesterday was, or what tomorrow will be. It can also
    tell you the day of any valid date that you pass to it.">
     <CFFUNCTION NAME="getToday"
      HINT="Returns the name of the day today."
      ACCESS="remote"
      returntype="string">
      <CFRETURN  dayofweekAsString(dayofweek(now()))>
     </CFFUNCTION>
     <CFFUNCTION NAME="getYesterday"
      HINT="Returns the name of the day yesterday."
      ACCESS="remote"
      returntype="string">
       <CFRETURN dayofweekAsString(dayofweek(dateadd("d", -1, now())))>
     </CFFUNCTION>
     <CFFUNCTION NAME="getTomorrow"
      HINT="Returns the name of the day tomorrow."
      ACCESS="remote"
      returntype="string">
       <CFRETURN dayofweekAsString(dayofweek(dateadd("d", 1, now())))>
     </CFFUNCTION>
     <CFFUNCTION NAME="getThisDayName"
      HINT="Allows you to pass an arbitrary date. The function
      returns the name of the day that this date falls on.
      Be sure to pass a valid date. For example: '12/1/2002'."
      ACCESS="remote"
      returntype="string">
       <CFARGUMENT name="day">
       <CFRETURN dayofweekAsString(dayofweek(day))>
     </CFFUNCTION>
    </CFCOMPONENT>

     

    Now that we're finished writing the code for our Web service, we'll now need to understand how to expose it. A Web service has to be accompanied by a Web Services Description Language (WSDL) file that describes the Web service so other systems can make sense of it. ColdFusion components generate WSDL files automatically for us! To access the WSDL file for our Web service, just request the .cfc file directly in your browser followed by "?WSDL" at the end. For example, on my computer, when I request:

    http://localhost:8500/dateExample.cfc?WSDL

    The browser returns this file seen below.

    Macromedia ColdFusion date Example WSDL

    You can use 127.0.0.1 or "localhost" to refer to your local machine. The CFMX development Web server installs on port 8500 by default, so that's why my examples reference port 8500. Web services, in general, will run on the same port as your regular ColdFusion pages unless you intentionally set your server up for some other arrangement.

    When you see all of the XML that gets generated, don't panic. We don't have to deal with any of it. We are only interested in the WSDL link itself.

    Believe it or not, we're done. The person interested in using the awesome new Web service will need to know the path to the appropriate WSDL file in order to be able to use it, so we'll need to make it available on our CFMX-enabled Web server. Other systems — whatever the programming language might be — can now use the <CFFUNCTION>s that we've defined in our "dateExample" component. This is cool.

    Next, we'll take a look at how to use Web services hosted by somebody else's system.