<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3225763195468554727</id><updated>2026-07-26T20:44:15.088+05:30</updated><category term="ColdFusion"/><category term="ColdFusion 10"/><category term="REST"/><category term="axis"/><category term="web services"/><category term="ColdFusion Zeus"/><category term="REST Services"/><category term="Tutorial on REST"/><category term="Arrays"/><category term="CF theme"/><category term="Chrome"/><category term="Chrome theme"/><category term="ColdFusion Blogs"/><category term="Contents"/><category term="HTTP basic authentication"/><category term="Logger"/><category term="Part-I"/><category term="Query"/><category term="REST application"/><category term="Register application"/><category term="Struct"/><category term="Structure"/><category term="Theme"/><category term="administrator"/><category term="arrayCompare"/><category term="authentication"/><category term="authorized"/><category term="cfhttp"/><category term="cfinvoke"/><category term="cflogin"/><category term="cfloop"/><category term="cfobject"/><category term="client-config.wsdd"/><category term="consumed"/><category term="continue"/><category term="cool blue CF theme"/><category term="default application"/><category term="delete application"/><category term="equate complex types"/><category term="handler"/><category term="helloWorld"/><category term="isAuthorized"/><category term="loop"/><category term="password"/><category term="published"/><category term="queryCompare"/><category term="refresh application"/><category term="register REST"/><category term="request"/><category term="requestFlow"/><category term="response"/><category term="responseFlow"/><category term="secured"/><category term="security"/><category term="sign"/><category term="structCompare"/><category term="username"/><category term="wsdd"/><title type='text'>ColdFusion and Stuff</title><subtitle type='html'>This blog is all about tricks/tweaks/details of ColdFusion and related technologies</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-6939811666264417215</id><published>2016-02-18T16:56:00.002+05:30</published><updated>2016-02-18T17:42:31.400+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="axis"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion 10"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Has your webservice code stopped working after ColdFusion10 because of Axis2 ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;

In past few years I have seen many people struggling with their working webservice code which broke in ColdFusion10 onwards. Code works till CF9 but stops working since CF10 and they get errors like ServiceInvocationExcption or Axis2 AxisFault.&lt;br /&gt;
&lt;br /&gt;
This happens because ColdFusion 9 introduced Axis2(Axis is the internal engine used in CF for SOAP based services) for their webservices. Axis1(the older version) is still available but is not the default one. This means that your existing code will now use axis2 engine by default. For most of the customers(I can assume 95%+) it works and performs better than previous versions but for some unfortunate of them it broke.&lt;br /&gt;
&lt;br /&gt;
Here is what you need to make it work again.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;As a fallback CF provided a way to use axis1. When you create a webservice object, you have to pass one extra parameter in arguments called wsversion=1&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Older Code&lt;/b&gt;
&lt;script beforecf9.cfc=&quot;&quot; class=&quot;brush:cf; title=&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---code starts---&gt;
&lt;cfscript&gt;
    stAuth = structNew();
    stAuth.username = &quot;user&quot;;
    stAuth.password = &quot;pass&quot;;
    ws = createObject(&quot;webservice&quot;, &quot;example.com/myservice?wsdl&quot;, stAuth);
&lt;/cfscript&gt;
&lt;!---code ends---&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;New Code&lt;/b&gt;
&lt;script class=&quot;brush:cf;highlight:[5,6];&quot; title=&quot;aftercf9.cfc&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cfscript&gt;
    stAuth = structNew();
    stAuth.username = &quot;user&quot;;
    stAuth.password = &quot;pass&quot;;
    stAuth.wsversion=1;
    stAuth.refreshWSDL=true;
    ws = createObject(&quot;webservice&quot;, &quot;example.com/myservice?wsdl&quot;, stAuth);
&lt;/cfscript&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;i&gt;the refreshWSDL should not be used in production, this is only used to clear the cache and should remove it after you test it in development, otherwise everytime a new stub will be generated in production reducing the performance&lt;/i&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can read my previous article &lt;i&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/07/axis-2-and-axis-1-compatibility-issues.html&quot;&gt;here&lt;/a&gt;&lt;/i&gt; to understand probable issues you are facing with axis2 version.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/6939811666264417215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2016/02/has-your-webservice-code-stopped.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/6939811666264417215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/6939811666264417215'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2016/02/has-your-webservice-code-stopped.html' title='Has your webservice code stopped working after ColdFusion10 because of Axis2 ?'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-7316442386246047510</id><published>2015-07-29T12:24:00.004+05:30</published><updated>2016-02-18T17:35:34.992+05:30</updated><title type='text'>CFB profiles and Preferences</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;CFB profiles and Preferences&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Profiles is one of my favourite features of CFB3. It allows you to keep separate preferences as schemes(profiles we call it). For example when you are developing or writing code, you want to see your comments in yellow but when you demo your application you want to keep your comments in grey so they are not catchy. You don&#39;t have to change your comment colors always but you just have to switch your profile. To be specific you can maintain different color schemes, code-assist preferences, typing preferences, task tags, outline and syntax checking preferences with different profiles. For most developers modifying these small preferences increase their productivity, so trust me these are very helpful.&lt;br /&gt;
&lt;br /&gt;
Here we will talk about how to maintain different profiles and also a bit about all these preferences that you can modify and play with and will be starting with Code Assist Preferences. To find them in CFB open Window-&amp;gt;Preferences in your menubar. A preferences dialog will open. On left panel you have to reach to &quot;ColdFusion-&amp;gt;Profiles-&amp;gt;Editor-&amp;gt;Code Assist&quot;. On clicking it, in right panel you will see all related preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Code Asisst&lt;/b&gt;:&lt;br /&gt;
For most of preferences, you will be able to understand what they do by their name, like in case of Code Assist they will help you modify what you see in code assist and how you get it and some related stuff.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;BTW code assist is the small popup you get regarding code when you are typing it. You can also forcefully call code assist by pressing ctrl+space. If you want to try it right now, go to some closing tag, remove part of it from end and hit ctrl+space, you will get a popup suggesting to auto complete that tag. Now quickly moving to the preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Code Assist Dictionary version: you can select which ColdFusion server version you are running your code. You never want tags/functions in code assist which will not work for your version of ColdFusion.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Reload Dictionaries: In case you have modified the dictionary, you can reload them to reflect changes.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Cycling Code Assist Proposals: type &quot;&amp;lt;cfset x = &quot; and hit ctrl+space, you will get some suggestions for variable names, but what if you wanted to type a function here. If cycling is enabled, on hitting space 2 times, you will get functions suggestions. The funda is keep ctrl pressed and keep hitting space until you get correct suggestion.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Filter proposals containing text: On typing &quot;&amp;lt;cfa&quot; you will get suggestions like &quot;&amp;lt;cfabort&amp;gt;, &amp;lt;cfajaximport&amp;gt;&quot;, all of them starting with &quot;cfa&quot;. If this is enabled, you will also get &quot;&amp;lt;cfbreak&amp;gt;&quot; because it has c,f,a characters in it. Filter proposal CONTAINING text.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Automatically display Code Assist when typing: pretty simple, if enabled, you start typing and you will see code assist wherever necessary, otherwise you have to hit ctrl+space everytime.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Automatically display SQL Code Assist when typing: same as above, just that this is applicable if you are typing in sql editor. &amp;nbsp;If you do not know whats sql editor, then type this shortcut while typing, &quot;ctrl+alt+W S&quot;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Delay before showing code assist(in milliseconds): As name says, code assist popup will open after this many milliseconds.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Automatically insert a single proposal: Say you type &quot;&amp;lt;cfoutpu&quot; and call code assist(by hitting ctrl+space), you will get a popup with one proposal called &quot;&amp;lt;cfoutput&amp;gt;&quot;, and then you hit enter on it to insert it. That is a overhead if it was a single proposal, you can directly insert it without getting a popup, it was anyways a single proposal. Enable this option to directly insert single proposal without getting a popup.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Automatically insert a closing tag: If you insert a tag from code assist when typing starting tag and this preference is enabled, then closing tag will be autoinserted.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Insert closing tag on a new line: enable this if you want closing tag on next line.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Append space after inserting selection: a space will be appended on insertion of proposal, it helps if you add a lot of attributes by code assist.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Automatically insert equals sign: equals sign will be appended automatically after attribute name is selected from proposal.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Auto insert required attributes: name itself explains, type &quot;&amp;lt;cfhtt&quot;, call code assist, hit proposal cfhttp, see url attribute is added on its own, because it&#39;s a required attribute, I can&#39;t think of a scenario, when you will use cfhttp without typing url attribute.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Automatically quote attributes: On selecting attribute proposals, if enabled, you will automatically get quotes after equals sign. And it will not work if you have disabled auto insert equals sign.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Character to use when quoting attribute: If you quotes attributes values with single quotes, you have an option to do that here, auto quoting will quote with character you specify here.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Outline&lt;/b&gt;: You can see the outline of your file in Outline view. Shortcut: &quot;Alt+Shift+Q O&quot;, or &quot;WIndow-&amp;gt;Show View-&amp;gt;Outline&quot; in menubar. Outline gives you brief summary of tags/functions used in your file and on clicking on a particular tag/function in outline, it will take you to your particular code where it is used. It is very helpful in very long files.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Show All tags: By default, you will get all tags in your outline view.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Show selected tags: Or you can chose which all tags to show in outline. You can add or remove the tags you want.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Syntax Checking&lt;/b&gt;: In case you made a typo while typing or you inserted a wrong attribute, wont it be beautiful to know right there that something is wrong with code before even running your file on server. Syntax checking helps you in that.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Enable syntax checking: enable or disable this feature.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Display syntax errors only on file save: if enabled, it will check for errors only on file save. You can enable this for better performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Task Tags&lt;/b&gt;: Task tags are very useful while coding. Suppose you are building a feature and for testing purposes you have hardcoded a path, but ideally in production server you want to manipulate it and make it safe. You can insert a &quot;TODO&quot; task by typing &quot;&amp;lt;!--- TODO ---&amp;gt;&quot;(or &quot;// TODO&quot; in cfscript) where you have hardcoded path. Later on before moving your project to production, you can open Tasks view and check all the TODO tasks you have left pending in your code.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;By default there are two tasks: TODO and FIXME are provided but you can add your tags too and there is no limit on that. You can also select/modify the priority of the tasks, If high priority is selected, then in Tasks view, red exclamation mark will appear in front of your task.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Typing&lt;/b&gt;: Some preferences which will help you while typing.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Enable Auto insertion: This is a parent preference for following six preferences. If disabled, auto insertion of matching character will not be performed. Like on typing a double quotes, another double quotes following it is automatically inserted.Or on typing {, } this will be automatically inserted.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Double Quotes: typing &quot; will insert following &quot; on its own.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Similarly we have Single Quotes, Round brackets, Curly Brackets, Square brackets, Pound sign.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Auto close tags: When to auto close the starting tag. You can disable this by &amp;nbsp;choosing never.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Auto-indent on carriage return: If enabled, on hitting enter, a &quot;TAB&quot; will be automatically inserted on new line. It helps in beautifying the code.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Auto adjust indentation on closing tags: If you typed closing tag with wrong indentation, if enabled, it will adjust the indentation according to the starting tag.&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Replace whitespace with indentation character: If you are editing a legacy file, it might be possible that whitespaces are used for indentation, enabling this preference will replace those characters with indentation character wherever you edit. This indentation character can be specified in Formatter preferences.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Syntax Coloring&lt;/b&gt;: Syntax Coloring is one the most important feature of any editor. CFB gives you option to have different colors for different language. Like you can keep comments in yellow for ColdFusion but grey in HTML or JS. You can do chose colors for CFML, CFScript, HTML, JS, CSS. But all these colors will be applied in CFML or a CFC page. If you are editing a html file(file with extension html or htm) or JS file(file with extension js), these settings will not be applied. For that you need to refer &quot;HTML-&amp;gt;EDitor-&amp;gt;Syntax Coloring&quot; in left pane or &quot;JavaScript-&amp;gt;EDitor-&amp;gt;Syntax Coloring&quot; or &quot;CSS-&amp;gt;EDitor-&amp;gt;Syntax Coloring&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;We have two panes in these preferences. In left pane you will see tree of keys like Tag key under CFML or Attribute Name under CFML and so on. If you a select a key under a particular langauge, then on right pane you will see few preferences you can change. Like foreground color, Enable option, Bold, italic, Underline, Strikethrough options. With these you can controll each and every keys behavior in detailed manner.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;I will not discuss each and every key as their names pretty much explains them. You just need to play with them to understand it.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;One more important feature in Syntax Coloing is importing and exporting colors. CFB2 colors are not compatible with CFB3, so importing CFB2 colors will not work. On exporting .col file will be generated with all the color information. Similarly to import colors, a compatible .col has to be provided.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since we are done with all the preferences, I will explain the &lt;b&gt;Profiles page&lt;/b&gt;. In profiles page you will see a drop down listing all the profiles. And Active profile will be selected. CFB comes with 4 default profiles which you will not be able to modify or delete. These are CFB1, CFEclipse, Dreamweaver and default(ColdFusion Builder&#39;s own) profiles, we call these as system profiles. So in case you have &amp;nbsp;migrated from dreamweaver to CFB, you must be used to dreamweaver&#39;s shortcuts or coloring scheme, just select dreamweaver profile, hit apply and all settings, colors, shortcuts will be applied as they are in dreamweaver. Pretty solid feature isn&#39;t it? Well that&#39;s for default profiles, but you can create your own custom profile too.&lt;br /&gt;
To create a custom profile, hit &quot;Create New Profile&quot;, it will ask for a profile name and ofcourse you cannot name of system profile. On creating a new profile, all the settings in it will be copied from currently active profile. So if dreamweaver profile is active, and you created a new profile, all the dreamweaver&#39;s profile preferences will be copied in this new profile.&lt;br /&gt;
When you make any changes in the preference pages falling under profiles page, all these changes will be saved in your custom profile. So if your custom profile is selected, and you have changed the dictionary version, then even on restarting Builder, this setting will persist, which I think is the expected behaviour of Profiles. There is a catch in saving profile, if any system profile is selected let&#39;s say dreamweaver, and you change any preference under profiles, let&#39;s say you change dictionary version, then this settign will be saved(as expected). But earlier I said system profiles cannot be changed, so will they not be persisted? Don&#39;t worry, they will be. In this case a new profile will be created for you called &quot;custom&quot; and all the new changes will be saved in this custom profile. Now if you will try to change this profile, it will ask you whether you want to save this custom profile. So you can mistakenly delete or loose your preferences as it will always ask you to save or discard the changes first.&lt;br /&gt;
As I said, its pretty important and strong feature, play around it, you will enjoy it for sure.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/7316442386246047510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2015/07/cfb-profiles-and-preferences-profiles.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/7316442386246047510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/7316442386246047510'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2015/07/cfb-profiles-and-preferences-profiles.html' title='CFB profiles and Preferences'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-4685953875128788273</id><published>2014-02-28T17:55:00.002+05:30</published><updated>2016-02-18T17:36:00.630+05:30</updated><title type='text'>CF New Mobile Project - Templates</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;

&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;
You must be hearing about the mobile story in CF11, well yes, that is Huge. And if you haven&#39;t tried it yet, you are definitely missing a lot. Go on, try it but wait, don&#39;t you need a getting started tutorial. I bet you don&#39;t, only if you know that ColdFusion is providing templates for mobile project. Yes, you heard me right, templates. Isn&#39;t that great, you will get pre-baked code for your application. If you know what kind of application you want to create, just chose a template and wow! your application structure is ready. Alright, so now if you are interested enough to see how this works just read along otherwise still read along, I am sure you will feel like using it.&lt;br /&gt;
&lt;br /&gt;
First thing first, this template feature is available in CFBuilder and being said that let me make you aware of the importance of CFBuilder3 with ColdFusion11. With CFB3 you will feel the actual power of mobile in CF11. Why is that? because with CFBuilder you can start right from scratch, use templates to create a mobile project, use builder&#39;s code assist to help you with new mobile functions, create a packaged application for iOS/Android, download it and install, DEBUG it from you device, inspect it with WEINRE and so much...&lt;br /&gt;
&lt;br /&gt;
Now coming to the template feature, here are the steps you need to perform before you can try it.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Install CFBuilder3&lt;/li&gt;
&lt;li&gt;ColdFusion server will be installed with it(if you opt for it while installation)&lt;/li&gt;
&lt;li&gt;Start CFBuilder&lt;/li&gt;
&lt;li&gt;Create a New Mobile Project&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
This is where you will see a template page. Just to get you familiar with, here is a screenshot.&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmyEDf5Ve7NWip6nT3cxFFHUH9z6gkQDMHmBwGLOknvjhiD4ukJ8x1FxiGqHUMvlg7R1xuYZ_Vkl0-D-HU5erL-SccCq8uscedeLnKel7sPH5SARI3fkd7p0aUKQs_WqWZoicOUzXmsz8/s1600/mobile-template-screenshot3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmyEDf5Ve7NWip6nT3cxFFHUH9z6gkQDMHmBwGLOknvjhiD4ukJ8x1FxiGqHUMvlg7R1xuYZ_Vkl0-D-HU5erL-SccCq8uscedeLnKel7sPH5SARI3fkd7p0aUKQs_WqWZoicOUzXmsz8/s1600/mobile-template-screenshot3.png&quot; width=&quot;319&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;goog_1434291517&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1434291518&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
Notice I have marked the areas of screenshot so it will be easier to refer them while explaining. I know the red markers look ugly but please bear with me. I&#39;ll explain area one by one&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;System Templates:&amp;nbsp;&lt;/b&gt;These are the templates provided by ColdFusion. Right now there are only few templates but with future releases you may enjoy more templates here.&lt;br /&gt;
Very first template listed is&amp;nbsp;&lt;i&gt;Blank.&lt;/i&gt;&amp;nbsp;You can opt this template if you don&#39;t want to go with the other templates provided by ColdFusion.&amp;nbsp;This template will create&amp;nbsp;&lt;i&gt;index.cfm&lt;/i&gt;&amp;nbsp;in your project,&amp;nbsp;with just&amp;nbsp;&lt;i&gt;cfclient&lt;/i&gt;&amp;nbsp;tags in it and you are free to create app the way you want. This will be the default template selected every time you open this wizard.&lt;br /&gt;
Second one is&amp;nbsp;&lt;i&gt;Master-Detail&lt;/i&gt;&amp;nbsp;template. This is a pretty common and famous one in mobile devices. The&amp;nbsp;&lt;i&gt;index.cfm&lt;/i&gt;&amp;nbsp;generated using this template will contain all the required code to show a basic master-detail UI in page/device-app. The settings page in smartphones is a very good example of such a layout. Initially you will get a list of items, called as mater page and on clicking on an item, you will see details about it, called as detail page.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;User Templates:&amp;nbsp;&lt;/b&gt;If you want much more than default templates, this is just the right section for you. You can create your own templates and use them every time you create a project. Even more, you can share it in ColdFusion community to let CF developers take full benefit of it. I will talk more about&amp;nbsp;&lt;i&gt;&lt;a href=&quot;http:/#create_template&quot;&gt;creating your own template&lt;/a&gt;&lt;/i&gt;&amp;nbsp;in separate section.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Type:&amp;nbsp;&lt;/b&gt;After selecting a template, this is where you can select the type using which you want to create the template. With each template there could be multiple types associated. There are many libraries available to create mobile apps like JQuery Mobile, bootstrap etc.. So it&#39;s possible to create same layout using different libraries which is why multiple types with each template. You can chose the one you like. By default the very first type listed will be auto-selected. Once you select the type,&amp;nbsp;&lt;i&gt;Next&lt;/i&gt;&amp;nbsp;button in wizard will be enabled and you can navigate to next page.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Description:&amp;nbsp;&lt;/b&gt;This is where you will read the description about the template. Description changes according to your selection of template and type.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Import:&amp;nbsp;&lt;/b&gt;You can import the templates too, be that your self created template or community shared template. Once imported you will see the template added in User Templates section, chose it and create your project.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Next: &lt;/b&gt;Next button will be enabled if both the Template and it&#39;s respective Type is selected. By default &lt;i&gt;Blank&lt;/i&gt;&amp;nbsp;template and &lt;i&gt;None&lt;/i&gt;&amp;nbsp;type will be selected. Once done, navigate to next page.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;b id=&quot;create_template&quot;&gt;Creating custom template&lt;/b&gt;&lt;br /&gt;
Before I start on creating custom template let me tell you that where these templates are saved. Both System templates and User templates are picked from this path: &lt;i&gt;CFBuilder_installation_directory/templates/mobile/&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
You will see two directories in it, System and User. System directory is to keep templates provided by ColdFusion and the User one is to keep User templates. For further reference I will refer these as System Template directory and User Template directory.&lt;br /&gt;
&lt;br /&gt;
At beginning User Template directory will be empty but System Template directory must be containing few templates. Though you can refer the the templates present in it but I will recommend not to change anything in it.&lt;br /&gt;
&lt;br /&gt;
Templates are supported in both zipped and directory format. So let&#39;s start with the directory format because for zipped format all we need to do is zip the template directory. Follow the steps&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Create an empty folder, give it a name of your choice(can be used as template name in case name not provided in configuration file).&lt;/li&gt;
&lt;li&gt;Create &lt;i&gt;config.xml&lt;/i&gt;&amp;nbsp;file in it. Config file is used by CFBuilder to scan through valid templates and their information. Here is a sample code for config.xml
&lt;script class=&quot;brush:xml&quot; title=&quot;config.xml&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;template name=&quot;template name&quot;&gt;
 &lt;description&gt;
  This is general template description.
 &lt;/description&gt;
 &lt;types&gt;
  &lt;type value=&quot;JQuery Mobile&quot; &gt;
   &lt;description&gt;
    This is type(JQuery Mobile) specific description
   &lt;/description&gt;
  &lt;/type&gt;
  &lt;type value=&quot;Bootstrap&quot; &gt;
   &lt;description&gt;
    This is type(Bootstrap) specific description
   &lt;/description&gt;
  &lt;/type&gt;
 &lt;/types&gt;
&lt;/template&gt;
&lt;/script&gt;
&lt;ul&gt;
&lt;li&gt;The name of the template will be picked from root element&amp;nbsp;&lt;i&gt;template&lt;/i&gt; attribute &lt;i&gt;name&lt;/i&gt;. If &lt;i&gt;name &lt;/i&gt;is absent then directory&#39;s/zipped-file&#39;s name will be shown as template name.&lt;/li&gt;
&lt;li&gt;Description will be read from &lt;i&gt;description&lt;/i&gt;&amp;nbsp;element, child of root element. This description will only be shown if type specific description is missing.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;type&lt;/i&gt;&amp;nbsp;element inside &lt;i&gt;types&lt;/i&gt; will be used for specifying type information. The name of the type will be picked form attribute &lt;i&gt;value&lt;/i&gt;. The type description will be picked from &lt;i&gt;description&lt;/i&gt;&amp;nbsp;element present as child of &lt;i&gt;type&lt;/i&gt;. If this description is missing then generic description will be shown.&lt;/li&gt;
&lt;li&gt;You can give as many types as you want.&lt;/li&gt;
&lt;li&gt;We map each type to a directory, so there should be a directory present in parallel to config file, with the same name you have specified in &lt;i&gt;value&lt;/i&gt; attribute of each type. For this example there should be 2 directories present namely: JQuery Mobile and Bootstrap, each directory mapping to each type. Any extra directories kept parallel to config file will be ignored&lt;/li&gt;
&lt;li&gt;If the directory is missing for a type then that particular type will not be listed in Type section.&lt;/li&gt;
&lt;li&gt;On successful completion of project, the directory that is mapped to type will be exploded in your project. Files/Folders present in this directory will be copied to your project location.&lt;/li&gt;
&lt;li&gt;There should be at least one type mentioned in config.xml with mapped directory present otherwise template will be considered as invalid.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;As specified in previous steps create required directories parallel to &lt;i&gt;config.xml&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;In directories(created in previous steps) create the files/folders you want in your project. If index.cfm is present here then on successful completion of project it will be opened for you automatically.&lt;/li&gt;
&lt;li&gt;Place the directory you created in step one inside User Templates directory or you can use import feature of wizard. I will recommend to use import functionality, that way you will know if your template is valid or not. If your template is not valid and you have placed it in User Template directory by yourself, then your template will not be listed in wizard.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;To import you have to create a zip file of your template. Create a zip in a way that zipped file should directly contain config file and directories that are mapped to type.&lt;/li&gt;
&lt;li&gt;From import section of wizard, press import, browse to zipped template you have created and wola! If it was a valid template then you will get successful message otherwise a descriptive error about the problem with your template.&lt;/li&gt;
&lt;li&gt;Template that you imported in previous step will be copied to User Template directory, in case you want to check. And no need to close CFB or wizard, just after importing you can see your template right under User Templates.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
After this I think you are good to go. Once you will create your project, you will see your template files in project and you can test it either by running it as ColdFusion application or creating a packaged app and installing it in device. For other details like packaging application or debugging it or inspecting it, keep looking for more blogs but I think this is good point for you to start. Go on now, build your apps.&lt;/div&gt;
&lt;br /&gt;
-Milan.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/4685953875128788273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2014/02/cf-new-mobile-project-templates.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/4685953875128788273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/4685953875128788273'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2014/02/cf-new-mobile-project-templates.html' title='CF New Mobile Project - Templates'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmyEDf5Ve7NWip6nT3cxFFHUH9z6gkQDMHmBwGLOknvjhiD4ukJ8x1FxiGqHUMvlg7R1xuYZ_Vkl0-D-HU5erL-SccCq8uscedeLnKel7sPH5SARI3fkd7p0aUKQs_WqWZoicOUzXmsz8/s72-c/mobile-template-screenshot3.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-3774801215219345727</id><published>2013-01-09T21:22:00.001+05:30</published><updated>2016-02-18T17:36:33.391+05:30</updated><title type='text'>Javascript Date Time parsing rules</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Though these rules vary from browser to browser but still I am trying to put basic rules which are implemented by majority of popular browsers. To be on safer side please try these in your browser first.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;JavaScript by default uses a simplified version of the ISO 8601 extended format to convert strings to Date objects&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;You can specify strings to construct Date objects either with&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;code&quot; style=&quot;color: darkgreen; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; line-height: 20px;&quot;&gt;Date(dateStr)&lt;/span&gt;&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&amp;nbsp;or with&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;code&quot; style=&quot;color: darkgreen; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; line-height: 20px;&quot;&gt;Date.parse(dateStr)&lt;/span&gt;&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;. JavaScript first attempts to parse a date string by using the ISO format. If the date string is not in that format, JavaScript attempts to parse the date by using other date parsing rules.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
The ISO format is a simplification of the ISO 8601 extended format. The format is as follows:&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
&lt;span class=&quot;code&quot; style=&quot;color: darkgreen; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;YYYY-MM-DDTHH:mm:ss.sssZ&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
To return a date in ISO format, you can use the&amp;nbsp;toISOString.&lt;/div&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
If a date string is not in the ISO format, JavaScript uses the following rules to parse it.&lt;/div&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;padding-bottom: 15px;&quot;&gt;
Short dates&lt;/div&gt;
&lt;ul style=&quot;color: black;&quot;&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
The format must follow the month/day/year order, for example &quot;06/08/2010&quot;.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
Either &quot;/&quot; or &quot;-&quot; can be used as a separator.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;padding-bottom: 15px;&quot;&gt;
Long dates&lt;/div&gt;
&lt;ul style=&quot;color: black;&quot;&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
The year, month, and day can be in any order. &quot;June 8 2010&quot; and &quot;2010 June 8&quot; are both valid.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
The year can have two or four digits. If the year has only two digits, it must be at least 70.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
Month and day names must have at least two characters. Two character names that are not unique are resolved to the last matching name. For example, &quot;Ju&quot; specifies July, not June.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
A day of the week is ignored if it is inconsistent with the rest of the supplied date. For example, &quot;Tuesday November 9 1996&quot; resolves to &quot;Friday November 9 1996&quot; because Friday is the correct day of the week for that date.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;padding-bottom: 15px;&quot;&gt;
Times&lt;/div&gt;
&lt;ul style=&quot;color: black;&quot;&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
Hours, minutes, and seconds are separated by colons. However, some of the parts can be omitted. The following are valid: &quot;10:&quot;, &quot;10:11&quot;, and &quot;10:11:12&quot;.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
If PM is specified and the specified hour is at least 13, NaN is returned. For example, &quot;23:15 PM&quot; returns NaN.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;padding-bottom: 15px;&quot;&gt;
General&lt;/div&gt;
&lt;ul style=&quot;color: black;&quot;&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
A string that contains an invalid date returns NaN. For example, a string that contains two years or two months returns NaN.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
JavaScript supports all standard time zones, and Universal Coordinated Time (UTC) and Greenwich Mean Time (GMT). (The ISO format does not support time zones.)&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
Text enclosed in parentheses is treated as a comment. The parentheses can be nested.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: rgb(69, 69, 69) !important; line-height: 1.429em !important; padding-bottom: 15px;&quot;&gt;
Commas and spaces are treated as delimiters. Multiple delimiters are permitted.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;i&gt;You may find this link useful - &lt;a href=&quot;http://es5.github.com/#x15.9.1.15&quot; target=&quot;_blank&quot;&gt;ECMA script date time string format&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;color: rgb(69, 69, 69) !important; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding-bottom: 15px;&quot;&gt;
&lt;span class=&quot;code&quot; style=&quot;color: darkgreen; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;code&quot; style=&quot;color: darkgreen; font-family: &amp;quot;consolas&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #454545; font-family: &amp;quot;segoe ui&amp;quot; , &amp;quot;lucida grande&amp;quot; , &amp;quot;verdana&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/3774801215219345727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2013/01/javascript-date-time-parsing-rules.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3774801215219345727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3774801215219345727'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2013/01/javascript-date-time-parsing-rules.html' title='Javascript Date Time parsing rules'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-3782774520768603897</id><published>2012-07-13T04:32:00.000+05:30</published><updated>2016-02-18T17:36:51.536+05:30</updated><title type='text'>Axis-2 and Axis-1 compatibility issues</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;

&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;b&gt;Axis-2 and Axis-1 compatibility issues&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;

&lt;b&gt;&lt;b&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;Problem&lt;/b&gt;:&lt;/span&gt;&lt;/b&gt; &lt;/b&gt;&lt;/h3&gt;
With ColdFusion 10 you can leverage power of Axis-2 WebServices. But you might get into issues if you are mixing Axis-2 with Axis-1. Axis-2 services are incompatible with Axis-1 services in ColdFusion because of the way their WSDL&#39;s are formed. Though by design Axis-1 and Axis-2 are compatible but in ColdFusion you might run into issues if you are using ColdFusion complex data types.&lt;br /&gt;
&lt;br /&gt;
Since Axis-1 and Axis-2 are incompatible in ColdFusion, this means that if you are publishing your WebServices using Axis-2, then they should be consumed using Axis-2 only. Similarly if you are publishing your WebServices using Axis-1 then they should be consumed using Axis-1 only.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;

&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;b&gt;ColdFusion 10 Solution&lt;/b&gt;:&lt;/span&gt;&lt;/h3&gt;
ColdFusion has taken all the measures to support backward compatibility with it&#39;s earlier versions. ColdFusion allows you to specify the version of Axis in which WebServices should be published&lt;b&gt; &lt;/b&gt;or consumed. ColdFusion has given a control at three levels:&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Server level&lt;/li&gt;
&lt;li&gt;Application level&lt;/li&gt;
&lt;li&gt;Component level&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;

Publishing&lt;/h4&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;u&gt;Server level&lt;/u&gt;&lt;b&gt;:&lt;/b&gt; In ColdFusion 10 WebServices administrator page there is a new setting called as wsversion. This setting defines the default version of Axis that will be used to publish the WebServices in ColdFusion if you have not specified it at Application/Component level.&lt;br /&gt;&lt;br /&gt;Default value of this setting is set to &#39;2&#39;, which means by default your WebServices will be published using Axis-2. You can anytime change it to &#39;1&#39; if you are facing the problems.&lt;br /&gt;&lt;br /&gt;This will be very handy if you are consuming all your WebServices from ColdFusion 9. In ColdFusion 9 Axis-2 is not supported and hence your WebServices will be consume by Axis-1 only, so that is why if &lt;b&gt;all&lt;/b&gt; your WebServices are consumed in ColdFusion 9 then you can set this to default &#39;1&#39; for whole server.&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Application level&lt;/u&gt;: In Application.cfc you can specify an attribute as this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&amp;lt;cfset this.wssettings.version.publish = &quot;2&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Setting this attribute at Application level will ensure that all WebServices in this Application will be published using this version of Axis if not overridden at component level.&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Component level&lt;/u&gt;: In you WebService component (mywebservice.cfc) you can specify this attribute as this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&amp;lt;cfcomponent wsversion=&quot;1&quot;&amp;gt;&lt;/span&gt;Specifying this attribute will ensure that this WebService will be published using Axis-1&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;

Consuming&lt;/h4&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
ColdFusion understands that WebServices could be published from any platform and can be consumed from CF so to make it easy CF automatically detects if the service is published in Axis-2 or Axis-1. If it&#39;s published in Axis-2, CF will consume it using Axis-2 unless overridden and same goes for Axis-1 too.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
You can however override this behavior if you are very sure of the published verison, at two levels:&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;u&gt;Application level&lt;/u&gt;: In Application.cfc you can specify an attribute as this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&amp;lt;cfset this.wssettings.version.consume = &quot;2&quot;&amp;gt;&lt;/span&gt;Setting this attribute at Application level will ensure that all 
WebServices in this Application will be consumed using this version of 
Axis if not overridden at component level.&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Invoking level&lt;/u&gt;: While invoking the WebService you can specify an attribute &#39;&lt;i&gt;wsversion&lt;/i&gt;&#39; to tell CF from which version the Service should be consumed.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;ws=createObject(&quot;webservice&quot;,&quot;http://localhost:8500/mycfc.cfc?wsdl&quot;,{wsversion=&quot;2&quot;})&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&amp;lt;cfinvoke webservice = &quot;http://localhost:8500/mycfc.cfc?wsdl&quot; method=&quot;echo&quot; wsversion=&quot;2&quot; returnVariable=&quot;foo&quot; &amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
I am sure that if you read this post, you will never stuck in Axis-1/Axis-2 compatibility issues.&lt;br /&gt;
Specially it is a must for any user who is publishing WebService as in ColdFusion 10 but consuming them in ColdFusion 9 or earlier releases. It&#39;s because in CF 10 by default Axis-2 will be used whereas in earlier CF releases only Axis-1 was supported, so you might run into issues if will not take measures.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/3782774520768603897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/07/axis-2-and-axis-1-compatibility-issues.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3782774520768603897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3782774520768603897'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/07/axis-2-and-axis-1-compatibility-issues.html' title='Axis-2 and Axis-1 compatibility issues'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-5754949357533098771</id><published>2012-07-13T03:44:00.000+05:30</published><updated>2016-02-18T17:37:25.270+05:30</updated><title type='text'>ColdFusion 10 WebServices - Axis2 vs Axis1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I have seen many people getting confused between Axis-2 and Axis-1 WebServices in ColdFusion 10. ColdFusion 10 has added the support for Axis-2 WebService, earlier till ColdFusion 9 only Axis-1 WebServices were supported.&lt;br /&gt;
&lt;br /&gt;
So to begin with what exactly is this Axis-2 and Axis-1.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Intro Axis:&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Apache Axis&lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; (Axis-1) &lt;/span&gt;is an&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Open_source&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.200000762939453px; orphans: 2; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot; title=&quot;Open source&quot;&gt;open source&lt;/a&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;,&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/XML&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.200000762939453px; orphans: 2; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot; title=&quot;XML&quot;&gt;XML&lt;/a&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;based&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Web_service&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.200000762939453px; orphans: 2; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot; title=&quot;Web service&quot;&gt;Web service&lt;/a&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;framework. ColdFusion internally uses Axis to publish and consume WebServices.&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Apache Axis-2 is a complete re-design and re-write of the widely used&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Apache_Axis&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-image: none; background-position: initial initial; background-repeat: initial initial; color: #0b0080; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.200000762939453px; orphans: 2; text-align: start; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot; title=&quot;Apache Axis&quot;&gt;Apache Axis&lt;/a&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt; but achieves same purpose&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;. Axis-2 supports many new and flexible features over Axis-1 which means ColdFusion has implemented it not only to provide you latest features like Soap1.2 but also to give you more flexibility and power in your hand. &lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;You can always search for &#39;Axis-1 vs Axis2&#39; if you want to study the advantages of Axis-2.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;New in ColdFusion 10&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;So let&#39;s see what ColdFusion 10 is offering with Axis-2&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;SOAP 1.2 support (SOAP 1.1 was there with Axis-1)&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;WSDL2 support&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Wrapped styled WSDL support&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Easy switching from Axis-2 to Axis-1 and vice-versa.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Taking these points one by one.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;SOAP 1.2 support &lt;/b&gt;- SOAP is a standard protocol specification for exchanging messages and 1.2 is it&#39;s latest version. Being a ColdFusion user you should not worry about the implementation part but you should know that now you can consume much wider range of WebServices and also publish for a much wider userbase.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;WSDL2 support &lt;/b&gt;- WSDL is a standard XML format to expose your WebServices to outer World. Versoin 2 is the latest version of WSDL and now with ColdFusion 10 you can leverage it. Implementation is as expected way too simple. &lt;br /&gt;The WebService &lt;b&gt;WSDL&lt;/b&gt; links are like these : &lt;u&gt;&lt;i&gt;http://myip/mywebservice.cfc?wsdl&lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;The WebService &lt;b&gt;WSDL2&lt;/b&gt; links are like these : &lt;u&gt;&lt;i&gt;http://myip/mywebservice.cfc?wsdl2&lt;/i&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;Now to consume these WebServices using WSDL2 format just update the WSDL link by appending a numeric &#39;2&#39; in the end and you will be done. No change required from publishing side.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;b&gt;Wrapped styled WSDL&lt;/b&gt; - A user who has already used WebServices in any platform might be aware of terms like RPC style, Document-literal, Document-wrapped style WSDL. WSDL publishing formats could be in either of these widely used formats. Earlier RPC and Document-literal styles were supported but now Document-wrapped style is also supported.&lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;To use this a style attribute is provided at two level: Application level and Component level.&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;Application level: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&amp;lt;cfset this.wssettings.style = &quot;Wrapped | Document | RPC&quot;&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;Component level: &lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&amp;lt;cfcomponent wsversion=&quot;2&quot; style=&quot;Document | Wrapped | RPC&quot; &amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black; display: inline; float: none; font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;For in-depth details about new attributes in ColdFusion 10 WebServices read this blog &lt;a href=&quot;http://www.adobe.com/devnet/coldfusion/articles/axis2-web-services.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp;&lt;b&gt;Easy Switching&lt;/b&gt; - Axis-1 and Axis-2 has few compatibility issues because of their architecture which means if you are publishing in Axis-1, it has to be consumed by Axis-1 only and if a WebService is published in Axis-2 then it has to be consumed using Axis-2 only. ColdFusion is well aware that the users could face problem because of this behavior. So to it make very easy for users, ColdFusion 10 has taken few steps which are discussed in detail in this blog &lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/07/axis-2-and-axis-1-compatibility-issues.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;You may also like reading this -&amp;gt; &lt;/span&gt;&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;a href=&quot;http://www.adobe.com/devnet/coldfusion/articles/axis2-web-services.html&quot;&gt;http://www.adobe.com/devnet/coldfusion/articles/axis2-web-services.html&lt;/a&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: black; display: inline; float: none; font-family: sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.2px; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/5754949357533098771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/07/coldfusion-10-webservices-axis2-vs.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/5754949357533098771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/5754949357533098771'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/07/coldfusion-10-webservices-axis2-vs.html' title='ColdFusion 10 WebServices - Axis2 vs Axis1'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-7194158807796529430</id><published>2012-06-18T23:23:00.002+05:30</published><updated>2016-02-18T17:37:41.167+05:30</updated><title type='text'>Node.js to ColdFusion - REST api</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;

&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;

&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In my earlier post I explained how to expose a pdf service using ColdFusion REST api &lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/06/coldfusion-html-to-pdf-service-rest-api.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
In that post we saw that from the client side if I will pass a html document to this service it will convert it into pdf document and will return it back to the client. Also in my earlier post I gave an example to consume it using CF client itself. But there are times when your client side may not be ColdFusion. For that purpose I am giving an example to consume it using Node.js&lt;br /&gt;
&lt;br /&gt;
Node.js server will act as a client over here and will contact ColdFusion to convert a document into pdf document.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s take a look at the code.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;brush:js;&quot;&gt;/*---code starts---*/
function handlepdf(data) {
&amp;nbsp;
var http = require(&#39;http&#39;);
var fs = require(&#39;fs&#39;);

var options = {
  host: CFip,
  port: CFport,
  path: &#39;/rest/services/pdf&#39;,
  method: &#39;POST&#39;,
  headers: {
   &#39;Accept&#39;: &#39;text/xml&#39;
  }
 };
 
 var req = http.request(options, function(res) {
  var allchunk = &quot;&quot;;

  res.setEncoding(&#39;utf8&#39;);
  
  res.on(&#39;data&#39;, function (chunk) {
   allchunk += chunk;
  });
  
  res.on(&#39;end&#39;, function () {
   var file = allchunk;
    
   fs.writeFile( &#39;sample.pdf&#39;, allchunk, &#39;base64&#39;, function(err) {
    if(err) {
     console.log(err);
     } else {
     console.log(&quot;The file was saved!&quot;);
    }
   });
  });
 });
 
 req.write(data);
 req.end();
}
/*---code ends--*/
&lt;/pre&gt;
..&lt;br /&gt;
&lt;br /&gt;
Now lets understand the code:&lt;br /&gt;
&lt;br /&gt;
I have written a function handlepdf(data), which accepts the html document as an argument. You can call this function as a callback handler for any event you like.&lt;br /&gt;
&lt;br /&gt;
In this function I am making a http call to ColdFusion server because finally http request is all required for REST to work. I am setting the options of this request to match the CFC I created in my previous blog &lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/06/coldfusion-html-to-pdf-service-rest-api.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;method - post&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;ip - CF server ip&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;port - CF server port&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;path - rest/services/pdf&lt;/li&gt;
&lt;li&gt;accept header - &quot;text/xml&quot;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Now moving ahead there is another function which will be called when this http.request will be ready.&lt;/div&gt;
&lt;div&gt;
In this function I am initializing a variable &quot;allchunk&quot;, this is the variable where our complete pdf will be saved.&lt;/div&gt;
&lt;div&gt;
And on res.on(&#39;data&#39;), I have called another function. This function will be called whenever data will be received on response of this request. Inside this function I am appending all the data to &#39;allchunk&#39;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
One more way to do this was I could have taken allchunk in&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;res.on(&#39;data&#39;) function itself but the limitation with that approach is that sometimes if the file is big then the response comes in small chunks several times. So using the above used approach will give you complete file.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Once I recieved complete file then on res.on(&#39;end&#39;), I am writing this file from server itself, you can however pass to any client. For writing this file I am using filesystem package and writing it with encoding base64. Please take care of the encodings used while calling http request and saving the file otherwise your file could be corrupt.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;In the end I am writing the html data in request and closing it, which will call function we have discussed above.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
And extremely sorry for incomplete code of node.js but I just wanted to focus on calling ColdFusion part.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/7194158807796529430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/06/nodejs-to-coldfusion-rest-api.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/7194158807796529430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/7194158807796529430'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/06/nodejs-to-coldfusion-rest-api.html' title='Node.js to ColdFusion - REST api'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-8611076763178844119</id><published>2012-06-17T17:58:00.000+05:30</published><updated>2012-06-17T20:02:47.334+05:30</updated><title type='text'>ColdFusion html to pdf service - rest api</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
Convert a html document to PDF using ColdFusion &amp;lt;cfdocument&amp;gt; and REST power.&lt;br /&gt;
&lt;br /&gt;
If you are not sure about how to start with REST, you can read my blogs &lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/03/rest-coldfusion10-part3.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
So let&#39;s write a CFC which will be exposed as pdf service using REST api.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush:cf;highlight:[3,5,7];collapse:false&quot; title=&quot;helloWorld.cfc&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---code starts---&gt;
&lt;cfcomponent restpath=&quot;pdf&quot; &gt;
 &lt;cffunction name=&quot;converttopdf&quot; access=&quot;remote&quot; returntype=&quot;binary&quot; output=&quot;false&quot; httpmethod=&quot;post&quot; produces=&quot;application/xml&quot; &gt;
  &lt;cfargument name=&quot;data&quot; type=&quot;string&quot; &gt;
  &lt;cfset pdffile = &quot;&quot; &gt;
  &lt;cfdocument format=&quot;PDF&quot; overwrite=&quot;yes&quot; name=&quot;pdffile&quot; &gt;
   &lt;cfoutput&gt;#data#&lt;/cfoutput&gt;
  &lt;/cfdocument&gt;

  &lt;cfreturn #pdffile#&gt;
 &lt;/cffunction&gt;
&lt;/cfcomponent&gt;
&lt;!---code ends---&gt;
&lt;/script&gt;&lt;/div&gt;
Explanation:&lt;br /&gt;
Over here we have exposed a ColdFusion component as a REST resource - pdf, which will accept an html body and will return a pdf file in binary.&lt;br /&gt;
&lt;br /&gt;
In the only function present, I am accepting POST request and will produce the content in &quot;application/xml&quot; format. POST request will be accepted because my httpmethod attribute in the function is POST and produces attribute is &quot;application/xml&quot; so it will produce xml content.&lt;br /&gt;
&lt;br /&gt;
There is a point to note that even though I am producing xml content but still the produced string will not contain any xml tags. That is because ColdFusion only serializes the return variable in xml/json if it is complex variable like an Array, a Struct, a CFC etc.. As we are producing a binary which is a simple data type, so it will not be serialized rather will be returned as it is.&lt;br /&gt;
&lt;br /&gt;
For consuming the data I am looking for argument in body of the request. Generally you will find the restargsource attribute present in &amp;lt;cfargument&amp;gt; tag to tell you where to look for the data. But if it&#39;s absent ColdFusion looks for the argument in the body of request.&lt;br /&gt;
&lt;br /&gt;
Inside the function I am using &amp;lt;cfdocument&amp;gt; tag to convert the HTML body passed from client into PDF file. This PDF file will be saved in a variable name &quot;pdffile&quot; in binary format. And then returning this pdffile as it is in binary format back to the client.&lt;br /&gt;
&lt;br /&gt;
Client side can be written in any language but here I will write an exmaple in ColdFusion itself.&lt;br /&gt;
&lt;br /&gt;
All we need to do in client side is to call this service with POST http request and pass the HTML content in the body of the request.&lt;/div&gt;
&lt;script class=&quot;brush:cf;highlight:[2,4,9];collapse:false&quot; title=&quot;helloWorld.cfc&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---code starts---&gt;
&lt;cffile action=&quot;read&quot; file=&quot;sample.html&quot; variable=&quot;html&quot; &gt;

&lt;cfhttp url=&quot;localhost:8500/rest/services/pdf&quot; method=&quot;post&quot; &gt;
 &lt;cfhttpparam type=&quot;body&quot; value=&quot;#html#&quot; &gt;
 &lt;cfhttpparam type=&quot;header&quot; name=&quot;accept&quot; value=&quot;application/xml&quot; &gt;
&lt;/cfhttp&gt;

&lt;cffile action=&quot;write&quot; output=#ToBinary(cfhttp.filecontent)#  file=&quot;sample.pdf&quot; &gt;
&lt;!---code ends---&gt;
&lt;/script&gt;
..&lt;br /&gt;
In this example I am reading a html file from local directory and passing it&#39;s content to the service we just exposed.&lt;br /&gt;
And finally we are saving the result we have got back to sample.pdf&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. We are done.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/8611076763178844119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/06/coldfusion-html-to-pdf-service-rest-api.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/8611076763178844119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/8611076763178844119'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/06/coldfusion-html-to-pdf-service-rest-api.html' title='ColdFusion html to pdf service - rest api'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-3399076007319646508</id><published>2012-05-30T11:28:00.000+05:30</published><updated>2012-05-31T14:31:34.107+05:30</updated><title type='text'>ColdFusion 10 Chrome theme</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 0px; font-family: &#39;Liberation Sans&#39;, Helvetica, Arial, sans-serif; font-size: 12px; line-height: 19.200000762939453px; margin-bottom: 1.6em; outline: 0px; padding: 0px; text-align: -webkit-auto; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 0px; margin-bottom: 1.6em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
After&amp;nbsp;&lt;a href=&quot;http://blogs.coldfusion.com/assets/content/cf%20theme.crx&quot; style=&quot;border: 0px; color: #274f77; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;ColdFusion 9 Chrome theme&lt;/a&gt;, it&#39;s time to try&amp;nbsp;&lt;a href=&quot;http://blogs.coldfusion.com/assets/content/CF10_theme_new.crx&quot; target=&quot;_blank&quot;&gt;ColdFusion 10 Chrome theme&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;border: 0px; margin-bottom: 1.6em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you are using Chrome, try this ubercool dark theme and stay close to CF 10.&lt;/div&gt;
&lt;div style=&quot;border: 0px; margin-bottom: 1.6em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
How to use:&lt;/div&gt;
&lt;ol style=&quot;border: 0px; list-style-position: outside; margin: 0px 0px 1.6em 2.35em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Download ColdFusion theme from&amp;nbsp;&lt;a href=&quot;http://blogs.coldfusion.com/assets/content/CF10_theme_new.crx&quot; style=&quot;border: 0px; color: #274f77; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot; target=&quot;_blank&quot; title=&quot;cf_theme&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Save this file somewhere in your filesystem.&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Drag this file to your Chrome Browser.&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;It will ask you to continue(left-bottom).&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Press continue and whola!!!&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;To check open a new tab.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;border: 0px; margin-bottom: 1.6em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And ofcourse spread it if you like it :)&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/3399076007319646508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/05/coldfusion-10-chrome-theme.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3399076007319646508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3399076007319646508'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/05/coldfusion-10-chrome-theme.html' title='ColdFusion 10 Chrome theme'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-949313577610780780</id><published>2012-03-01T09:56:00.001+05:30</published><updated>2012-03-01T14:46:09.762+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion 10"/><category scheme="http://www.blogger.com/atom/ns#" term="helloWorld"/><category scheme="http://www.blogger.com/atom/ns#" term="REST"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial on REST"/><title type='text'>my first REST resource</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;


&lt;br /&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/03/rest-coldfusion10-part3.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;PART-III&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Tutorial on REST: First REST Resource(cfc)&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In first part we saw a simple example on REST to start off the things. So moving forward I will give another very simple example and will explain it.&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush:cf;highlight:[2,8];collapse:true&quot; title=&quot;helloWorld.cfc&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---code starts---&gt;
&lt;cfcomponent restpath=&quot;HelloWorld&quot; httpmethod=&quot;post&quot; rest=&quot;true&quot;&gt;
 &lt;cffunction name=&quot;World&quot; access=&quot;remote&quot; output=&quot;false&quot; returntype=&quot;string&quot; httpmethod=&quot;get&quot;&gt;
 
  &lt;cfreturn &quot;Hello World!&quot;&gt;
 &lt;/cffunction&gt;

 &lt;cffunction name=&quot;HiWorld&quot; access=&quot;remote&quot; output=&quot;false&quot; returntype=&quot;string&quot; httpmethod=&quot;get&quot; restpath=&quot;HiWorld&quot;&gt;
 
  &lt;cfreturn &quot;Hi World!&quot;&gt;
 &lt;/cffunction&gt;

&lt;/cfcomponent&gt;
&lt;!---code ends---&gt;
&lt;/script&gt;

&lt;script class=&quot;brush:cf;highlight:[2,8];collapse:true&quot; title=&quot;helloWorld.cfm&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---code starts---&gt;
&lt;cfhttp url=&quot;http://127.0.0.1:8500/rest/IIT/HelloWorld&quot; method=&quot;get&quot; result=&quot;res&quot;&gt;
&lt;/cfhttp&gt;

&lt;cfdump var=&quot;#res.filecontent#&quot;&gt;

&lt;/br&gt;&lt;/br&gt;

&lt;cfhttp url=&quot;http://127.0.0.1:8500/rest/IIT/HelloWorld/HiWorld&quot; method=&quot;get&quot; result=&quot;res&quot;&gt;
&lt;/cfhttp&gt;

&lt;cfdump var=&quot;#res.filecontent#&quot;&gt;
&lt;!---code ends---&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;helloWorld.cfc&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Every component and every function acts as a REST resource(if you are publishing them).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A new attribute in cfcomponent &#39;restpath&#39; OR &#39;rest&#39; defines if a component can be published as a REST resource. Either of these should be present.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Attribute &#39;httpmethod&#39; should be there in cffunction tag or cfcomponent tag. &#39;httpmethod&#39; in cffunction tag overrides the one in cffcomponent tag. To publish/expose a function as resource, this attribute is necessary. Valid values for this are &#39;GET&#39;, &#39;POST&#39;, &#39;PUT&#39;, &#39;DELETE&#39;, &#39;OPTION&#39;, &#39;HEAD&#39;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Similar to &#39;httpmethod&#39;, &#39;restpath&#39; can also be used in cffunction tag but it doesn&#39;t overrides the value of &#39;restpath&#39; in cffcomponent tag
, instead it appends to it. So if you want to call this function(resource), you need to give both the restpath&#39;s in URL. Check helloWorld.cfm&#39;s second http call for clearer picture&lt;/li&gt;
&lt;li&gt;Keeping other things simple like &#39;access=remote&#39;(required for REST/WEB services) and &#39;returntype=string&#39;, lets see how can we call this service.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b style=&quot;text-align: -webkit-auto;&quot;&gt;Note:&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;After writing a cfc(at-least one) in webroot, you need to register the folder(in which that REST cfc is present) as REST application, otherwise you will not be able to call any resource. Please check previous chapter for that.&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;b&gt;&lt;i&gt;helloWorld.cfm&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Considering that you registered this application with name &#39;IIT&#39;, the URL to access first resource(function HelloWorld) will be:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://127.0.0.1:8500/rest/Examples/HelloWorld&quot; style=&quot;text-align: -webkit-auto;&quot; target=&quot;new&quot;&gt;http://127.0.0.1:8500/rest/IIT/HelloWorld&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;So to access that resource all you need to do is, use cfhttp tag and call this URL. Keep in mind that method in cfhttp tag will match to the httpmethod present in function.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;Similarly to call the second Resource in cfc(function HiWorld), the URL will be:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://127.0.0.1:8500/rest/Examples/HelloWorld/HiWorld&quot; style=&quot;text-align: -webkit-auto;&quot; target=&quot;new&quot;&gt;http://127.0.0.1:8500/rest/IIT/HelloWorld/HiWorld&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;To call this from a cfm you need to call this URL using cfhttp tag with httpmethod as get.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;how the URL works:&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;Breaking the URL for better understading&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;http://127.0.0.1:8500/ - protocol//ip:port/&lt;/li&gt;
&lt;li&gt;rest/ - Compulsary string to call a REST resource. You can change this &#39;rest&#39; string in server.xml and restart the server for changes to take effect.&lt;/li&gt;
&lt;li&gt;Examples/ - Mapping name you give to register an application using Administrator or restInitApplication method(Check next example for this) .&lt;/li&gt;
&lt;li&gt;HelloWorld/ - RestPath to call a resource. This was given as &#39;restpath&#39; attribute in cfcomponent level.&lt;/li&gt;
&lt;li&gt;HiWorld/ - If your function also has a restpath then after giving a restpath for your component you need to give restpath for function also to call that function.&lt;/li&gt;
&lt;/ol&gt;
&lt;ol&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/03/rest-coldfusion10-part3.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/949313577610780780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/03/rest-coldfusion10-part3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/949313577610780780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/949313577610780780'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/03/rest-coldfusion10-part3.html' title='my first REST resource'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-1061048641784311158</id><published>2012-02-29T19:19:00.001+05:30</published><updated>2012-03-01T10:27:33.892+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="administrator"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion 10"/><category scheme="http://www.blogger.com/atom/ns#" term="default application"/><category scheme="http://www.blogger.com/atom/ns#" term="delete application"/><category scheme="http://www.blogger.com/atom/ns#" term="refresh application"/><category scheme="http://www.blogger.com/atom/ns#" term="Register application"/><category scheme="http://www.blogger.com/atom/ns#" term="REST"/><category scheme="http://www.blogger.com/atom/ns#" term="REST application"/><title type='text'>Registering a REST application in ColdFusion10</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;


&lt;br /&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/getting-started-with-rest-in-coldfusion.html&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/03/rest-coldfusion10-part3.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;PART-II&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;background-color: white; color: #444444; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;u&gt;Tutorial on REST: Registering a REST application&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;
Regitsering a REST application&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;To access any REST resource you need to register an application either through admin or using restInitApplication().&lt;/li&gt;
&lt;li&gt;Registering REST application is required because ColdFusion scans for all the REST resources present in directory you registered&lt;/li&gt;
&lt;li&gt;It is also important for you to know that you CAN NOT repeat &#39;restpath&#39; for one and more resources. That is why it is a better option to create multiple apps, so that you can repeat the restpath in different applications as per your need&lt;/li&gt;
&lt;li&gt;You should also know that change in any resource(REST cfc) of your application will need a refresh in applcation. You can refresh from Administrator or using restInitApplication()&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Using restInitApplication()&lt;/i&gt;&lt;/b&gt;&lt;i&gt;: You can register as well as refresh an application using this method&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;This function takes three attributes: restInitApplication(dir_path, mapping_name, default)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;dir_path: This is absolute path of the directory where you have plcaed your REST cfc.&lt;/li&gt;
&lt;li&gt;mapping_name: This name can be anything. But keep in mind that this name will be used URL to call any of the resources in this application. Also note that this is an optional attribute. If this attribute is not present then ColdFusion will try to pick this name from Application.cfc(this.name) applicable to this directory.&lt;/li&gt;
&lt;li&gt;default: You can get rid of the mapping_name in URL. To do so you can set any one of the application as default. I will discuss/explain this later with an example.&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;If there is no error thrown, means your application has been registered successfully, so its always better to catch the error using cfcatch block&lt;/li&gt;
&lt;li&gt;If there is already an application registered with the mapping_name and the dir_path you gave, then this function will REFRESH already registered app.&lt;/li&gt;
&lt;li&gt;But if you will try to register another directory with already registered mapping name, you will get an error&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;script class=&quot;brush:cf;highlight:[3];collapse:true&quot; title=&quot;restInit.cfm&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!--- code starts ---&gt;
&lt;cftry&gt;
&lt;cfset restInitApplication(&quot;#expandpath(&quot;..&quot;)#&quot;,&quot;IIT&quot;)&gt;

&lt;cfcatch type=&quot;any&quot;&gt;
    &lt;cfdump var=&quot;#cfcatch#&quot;&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
successfull!!
&lt;!--- code ends ---&gt;
&lt;/script&gt;
&lt;/div&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Using Administrator&lt;/b&gt;: You can also register an application using Administrator&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Go to Admin -&amp;gt; DATA &amp;amp; Services -&amp;gt; REST services&lt;/li&gt;
&lt;li&gt;Root Path: Browse the directory which you want to register as REST application&lt;/li&gt;
&lt;li&gt;Service Mapping: Give the name of your mapping. This name will be used in URL to call any of the resource present in this application. This is optional. If not given, ColdFusion will try to search for name in Application.cfc(this.name) applicable to that directory.&lt;/li&gt;
&lt;li&gt;default: You can get rid of the mapping_name in URL. To do so you can set any one of the application as default. I will discuss/explain this later with an example&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;Application outside webroot&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;You can also register a directory as REST application which is not present in your webroot&lt;/li&gt;
&lt;li&gt;To do so you have to add a mapping for that directory in ColdFusion&lt;/li&gt;
&lt;li&gt;Then you can register using the absolute path or also using that mapping instead of absolute path.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;i style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Default application&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;text-align: left;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
If you really do not like to use the application mapping name(IIT - example from previous chapter) for you REST services, there is an option available to do that. But I will personally recommend that if you are publishing your REST services in production, then you should use application mapping name to avoid conflicts and for better management.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To get rid of application name, all you need to do is, make that application as default. There are two ways to do it.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Go to Administrator-&amp;gt;REST Services page, edit that application, check the checkbox saying default and update it.&lt;/li&gt;
&lt;li&gt;Use below given code if you do not like to go to Admin.&lt;/li&gt;
&lt;/ol&gt;
&amp;lt;cfset restInitApplication(absolute_path, mapping_name, &quot;default&quot;)&amp;gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
This will set your application as default and to call your resource you need to hit this URL - &quot;http://localhost:8500/rest/restpath&quot; where restpath is the restpath of your resource.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Few points to remember using default&lt;/b&gt;:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
Default application is given last preference when you call some resource.&amp;nbsp;Let&#39;s say you have a resource with restpath: &quot;one/two&quot; in your default application and you have a resource: &quot;two&quot; in your application named as &quot;one&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;So on calling this url: &quot;http://127.0.0.1:8500/rest/one/two&quot;, resource with restpath: &quot;two&quot; will be served from application: &quot;one&quot;. But if application: &quot;one&quot; is not present then resource &quot;one/two&quot; will be served from default application.&lt;/li&gt;
&lt;li&gt;On calling this url: &quot;http://127.0.0.1:8500/rest/one/&quot; (notice a forward slash in the end of url), you will get resource not found, because there is no resource with restpath: &quot;/&quot; in application: &quot;one&quot;.&lt;/li&gt;
&lt;li&gt;On calling this url: &quot;http://127.0.0.1:8500/rest/one&quot;, it will search for resource: &quot;one&quot; in default application because url doesn&#39;t has a forward-slash after &quot;one&quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
There can only be one default application at a time.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Refresh Application&lt;/b&gt;:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
Once you have registered your application, you might want to change few things in your resources and want to services to reflect the effect. But there is a small&amp;nbsp;hindrance&amp;nbsp;in that. The time you register an application, ColdFusion loads the resources present in that application in memory, so if you are making some changes in you application, you need to tell ColdFusion in some way to refresh the application so that it can reflect the changes.&lt;br /&gt;
To achieve this there is a concept of refreshing an application. This can be done in two ways. One is from Administrator-REST Services page you can refresh whichever application you want. But if you want to do it right away from you code, you can use restInitApplication() function.&lt;br /&gt;
The same function for registering an application is also used for refreshing an application. If you are calling this function for some application but that application is already registered, then it will refresh it. So the trick is very simple. If application is not registered then restInitApplication() will register it, whereas if it is registered already, then it will refresh it.&lt;br /&gt;
For refreshing a default application you need not pass the third attribute(&quot;default&quot;) but for registering you need to.&lt;br /&gt;
&lt;br /&gt;
Please note that using this function is not recommended in Application.cfc, it might break things. You may use this function in any cfm.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Role of Application.cfc&lt;/b&gt;:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
If you have Application.cfc in the directory you want to register, then there are few things you might want to know.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;this.name - If application name is given in application.cfc, then while registering the application mapping name becomes optional. If you will not give application mapping name then your application will be registered using the name given in application.cfc&lt;/li&gt;
&lt;li&gt;this.restsettings.skipcfcwitherror - This is a boolean attribute. Usually if there some compilation error in any of your REST enabled cfc, then while registering you will get an error and you application will not be registered. But if this attribute is true, then even if there are errors in some cfc&#39;s, the rest of the cfc&#39;s will be published and your application will be registered successfully. Please note that if this attribute is true and all the cfc&#39;s have error then error will be thrown that no rest resource found.&lt;/li&gt;
&lt;li&gt;this.restsettings.cfclocation - you can give comma separated list of the directory path in this attribute. While registering or refreshing an application ColdFusion will search for all the rest enabled cfc&#39;s in these directories too. Please note that in this case, cfc&#39;s in current folder will not be considered. If you want to include present directory too, you need to give value something like this: this.restsettings.cfclocation = &quot;/myfolder, .&quot; (notice a dot after myfolder, to include present directory)&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;b&gt;Update/Delete an application&lt;/b&gt;:&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;To update already registered application you can go to administrator or you can use same function restInitApplication(). Lets say there is an application with path as &quot;/myfolder&quot; and mapping name as &quot;app1&quot;. Now if you call this function: restInitApplication(&quot;/myfolder&quot;, &quot;app2&quot;), your application registered with &quot;app1&quot; will get updated to &quot;app2&quot;.&lt;/li&gt;
&lt;li&gt;Though for registration/refreshing/updation same method was used but fortunately there is a separate method for deleting the REST application :) restDeleteApplication(absolute_path). You just need to pass the absolute path of the application registered to delete it.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;script class=&quot;brush:cf;highlight:[3];collapse:true&quot; title=&quot;restDelete.cfm&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!--- code starts ---&gt;
&lt;cftry&gt;
&lt;cfset restDeleteApplication(&quot;#expandpath(&quot;..&quot;)#&quot;)&gt;

&lt;cfcatch type=&quot;any&quot;&gt;
    &lt;cfdump var=&quot;#cfcatch#&quot;&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
successfull!!
&lt;!--- code ends ---&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
That will be enough for registering/updating/refreshing the REST applications. I guess so ;)&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/getting-started-with-rest-in-coldfusion.html&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/03/rest-coldfusion10-part3.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Milan.
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/1061048641784311158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/1061048641784311158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/1061048641784311158'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html' title='Registering a REST application in ColdFusion10'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-5587163930975605559</id><published>2012-02-21T02:54:00.001+05:30</published><updated>2012-03-01T10:02:11.013+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion 10"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion Zeus"/><category scheme="http://www.blogger.com/atom/ns#" term="Contents"/><category scheme="http://www.blogger.com/atom/ns#" term="REST"/><category scheme="http://www.blogger.com/atom/ns#" term="REST Services"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorial on REST"/><title type='text'>Tutorial on RESTful services in ColdFusion</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3225763195468554727#&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=3225763195468554727#&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/getting-started-with-rest-in-coldfusion.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Tutorial on REST: Introduction&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Much awaited ColdFusion10(Zeus) is out with many new, interesting and challenging features. And REST is one of them. So all the developers out there who wants to switch to REST services from SOAP based web services, get your hands on ColdFusion10 Public Beta now and start with REST right away.&lt;br /&gt;
&lt;br /&gt;
This tutorial is like a roller-coaster ride for REST services in ColdFusion10, which will quickly get you started with simple basics and easy examples and also it will cover all the complex techniques of this feature.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Tutorial on REST:&amp;nbsp;&lt;/u&gt;&lt;/b&gt;&lt;b&gt;&lt;u&gt;Contents&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #ffe599;&quot;&gt;For now to get you started here are initial few Parts, will be updating more with time.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/getting-started-with-rest-in-coldfusion.html&quot; target=&quot;&quot;&gt;Part-I :&amp;nbsp;Getting Started&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html&quot;&gt;Part-II: Registering a REST application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/03/rest-coldfusion10-part3.html&quot;&gt;Part-III: First REST Resource(cfc)&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a #&quot;=&quot;&quot; href=&quot;&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a #&quot;=&quot;&quot; href=&quot;&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/getting-started-with-rest-in-coldfusion.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;div&gt;
Thanks,&lt;/div&gt;
&lt;div&gt;
Milan.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/5587163930975605559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/tutorial-on-restful-services-in.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/5587163930975605559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/5587163930975605559'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/tutorial-on-restful-services-in.html' title='Tutorial on RESTful services in ColdFusion'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-6016956106557362231</id><published>2012-02-21T01:57:00.000+05:30</published><updated>2012-03-01T10:07:16.391+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="cfhttp"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion 10"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion Zeus"/><category scheme="http://www.blogger.com/atom/ns#" term="Part-I"/><category scheme="http://www.blogger.com/atom/ns#" term="register REST"/><category scheme="http://www.blogger.com/atom/ns#" term="REST"/><category scheme="http://www.blogger.com/atom/ns#" term="REST Services"/><title type='text'>Getting Started with REST in ColdFusion 10</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;


&lt;br /&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;u&gt;PART-I&lt;/u&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;u&gt;Tutorial on REST: Getting Started:&lt;/u&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
Background: REST services are a kind of web services which use http protocol behind the scenes. Geeks familiar with SOAP based web services must be thinking, Is this really possible (if they don&#39;t already know about REST architecture yet)? Yes, REST services uses HTTP architecture to get the work done and same way ColdFusion10 has beautifully used its component(cfc) to publish the REST services and cfhttp tags to consume them. For more information on REST architecture please go through &lt;a href=&quot;http://rest.elkstein.org/&quot;&gt;this&lt;/a&gt; link.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;Note - for simpler understanding, throughout the tutorial I will consider that ColdFusion is installed at &quot;C:\ColdFusion10\&quot; with webroot at &quot;C:\ColdFusion10\cfusion\wwwroot\&quot; and is running on port &quot;8500&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Publishing&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;After installing ColdFusion10 and setting the webroot(either through standalone or using webserver like IIS or Apache), first step required to setup REST is write a REST enabled cfc in some folder in webroot.&lt;/li&gt;
&lt;li&gt;Create a directory named &quot;restApp&quot; in webroot of ColdFusion. You can name this directory whatever you want to as this is just for your reference.&lt;/li&gt;
&lt;li&gt;Create a cfc named as &quot;studentHandler.cfc&quot;. You can name this cfc as anything you want. Your REST service users will not use this name untill and unless you are mentioning &quot;restpath&quot; at component level in your cfc. I will come to this point later&lt;/li&gt;
&lt;/ol&gt;
Paste code given below in this studentHandler.cfc&lt;br /&gt;
&lt;script class=&quot;brush:cf;highlight:[2,4];collapse:true&quot; title=&quot;studentHandler.cfc&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!--- code starts ---&gt;
&lt;cfcomponent restpath=&quot;student&quot; rest=&quot;true&quot;&gt;
 
 &lt;cffunction name=&quot;getMethod&quot; access=&quot;remote&quot; output=&quot;false&quot; returntype=&quot;string&quot; httpmethod=&quot;get&quot; description=&quot;A method to handle get calls in student resource&quot; &gt;
  
  &lt;!--- invoke name from database and return ---&gt;
  &lt;!--- for now returning sample name ---&gt;
  &lt;cfreturn &quot;foo&quot;&gt;
 &lt;/cffunction&gt;
 
&lt;/cfcomponent&gt;
&lt;!--- code ends ---&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
For those who prefers to stay independent of Administrator&lt;br /&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Just call this function from any cfm.&lt;/li&gt;
&lt;/ol&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;cfset restInitApplication(&quot;C:\ColdFusion10\cfusion\wwwroot\restApp&quot;,&quot;IIT&quot;)&amp;gt;&lt;br /&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;First argument to &quot;restInitApplication&quot; function is the absolute path where you have placed your REST component(studentHandler.cfc) and second argument is the name from which you will publish your REST application. You can give your relevant Organization name in second argument.&lt;/li&gt;
&lt;li&gt;If you didn&#39;t got any error after running this funtion, it means your application is registered successfully. That&#39;s it, first REST application published.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
For those who prefers to use ColdFusion Administrator page (http://127.0.0.1/8500/CFIDE/administrator/index.cfm)
&lt;br /&gt;
&lt;ol start=&quot;4&quot; style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;After saving this file go to Administrator --&amp;gt; REST services page&lt;/li&gt;
&lt;li&gt;In Path text box give the absolute path till directory &quot;restApp&quot;. In this example it will be &quot;C:\ColdFusion10\cfusion\wwwroot\restApp&quot;&lt;/li&gt;
&lt;li&gt;In mapping text box give some logical name for the REST application you going to create, let&#39;s say &quot;IIT&quot;. You can give your relevant Organization name. This name will be used by users in the URL&lt;/li&gt;
&lt;li&gt;Hit register, and there you go. First REST application published.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3_i2LakbJeSaSq455tK_KhVdzSj7ShjjPduj3OqNBT2doz7vLZESV2DbYfPQln_TOG2eaIHSobHaPYkAA_oKG21zw7biqadwTLo9i7AXL_y7lymfCpoKSFWO7SkcJpdHkYx1ZxKDleD8/s1600/admin.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;159&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3_i2LakbJeSaSq455tK_KhVdzSj7ShjjPduj3OqNBT2doz7vLZESV2DbYfPQln_TOG2eaIHSobHaPYkAA_oKG21zw7biqadwTLo9i7AXL_y7lymfCpoKSFWO7SkcJpdHkYx1ZxKDleD8/s320/admin.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;i&gt;Behind the scenes/tricks:&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
(these are quick tricks to know, but will covered in later parts of tutorial)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;When you hit &#39;restInitApplication()&#39; function, ColdFusion registers your application. You can also see that application later on in Administrator REST Services page.&lt;/li&gt;
&lt;li&gt;When you create a REST enabled component in your webroot and register that folder, ColdFusion consider that folder as one REST application.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;As many resources(cfc or functions in cfc) as you want, can be created in one application but the only thing is that restpath for these resources should not conflict with each other.&lt;/li&gt;
&lt;li&gt;Nested REST applications are not allowed.&lt;/li&gt;
&lt;li&gt;You can keep your application outside webroot too. For this you need to add a mapping for a directory in Administrator and then you can register this directory using&amp;nbsp;absolute path&amp;nbsp;or&amp;nbsp;mapping(the name with which you added a mapping), both will work.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Application names are case-INsensitive.&lt;/li&gt;
&lt;li&gt;Calling restInitApplication() for already registered application actually REFRESH that application.&lt;/li&gt;
&lt;li&gt;Calling&amp;nbsp;restInitApplication() with different mapping name(second attribute) will update the registered application with absolute path(first argument), with new name.&lt;/li&gt;
&lt;li&gt;If you want to skip giving application mapping name, you can use &#39;default&#39; feature, you can set an application as default and while consuming you can call a resource without giving mapping name in URL. Keep checking &amp;nbsp;this area for this point. I will write separate post for this.&lt;/li&gt;
&lt;li&gt;While registering an application, if application mapping name is not given, then it picks the same in the directory&#39;s(one you are trying to register) Application.cfc(this.name).&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;u&gt;Consuming&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;As you saw it was damn easy to publish a REST service but consuming is a lot Easier than that. All you need to do is hit this URL:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://127.0.0.1:8500/rest/IIT/student&quot; style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px; text-decoration: none;&quot;&gt;http://127.0.0.1:8500/rest/IIT/student&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;I hope you got the response as &quot;foo&quot;, because this is what we returned from studentHandler.cfc in function &quot;getMethod&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;How URL works:&lt;/i&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;http://127.0.0.1:8500/ - This is a equivalent to protocol://ip:port of your server in which the REST resource is present.&lt;/span&gt;
&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;/rest/ - This string &#39;rest&#39; in URL is necessary to tell ColdFusion that this is a REST call. You can change this &#39;rest&#39; in server.xml
&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;/IIT/ - this is the mapping_name from which you registered your REST application.
&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;/student/ - This is the restpath of the resource you defined in studentHandler.cfc
&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;i style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;Consuming in cfm:&lt;/i&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;For consuming REST services in cfm file you need to call the above URL using cfhttp tag.&lt;/span&gt;
&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;Run the code given below.
&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;script class=&quot;brush:cf;collapse:false&quot; title=&quot;studentHandler.cfm&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cfhttp url=&quot;http://127.0.0.1:8500/rest/IIT/student&quot; method=&quot;get&quot;&gt;
  
&lt;cfoutput&gt;#cfhttp.filecontent#&lt;/cfoutput&gt;
&lt;/script&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background-color: white; font-style: normal;&quot;&gt;Just take care that the method in cfhttp call should be &#39;get&#39;, as it has to match the &#39;httpmethod&#39; given in cfc.
&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;How this works&lt;/b&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: white; font-weight: normal;&quot;&gt;By looking at the URL, ColdFusion gets to know that this is a REST call and it also gets to know that for which application this call has been made because of the mapping name present in URL(&#39;IIT&#39; in this example)&lt;/span&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: white; font-weight: normal;&quot;&gt;Once we know that which application it is, we can easily get to know that which resource(cfc) has been called, because a cfc has a restpath which has to be unique for every appliction and this restpath is also included in URL(&#39;student&#39; in this example)
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: white; font-weight: normal;&quot;&gt;Once we get to know that which cfc has been called, we match the httpmethod of cffunction with the method of the request(cfhttp). In this example for both of them we mentioned &#39;GET&#39;. So by calling a get request on this resource we hit the function whose httpmethod is &#39;get&#39;.
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: white; font-weight: normal;&quot;&gt;Once we know which cffunction to call, its very easy to return the response.
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: white; font-weight: normal;&quot;&gt;There is also a possibility to have more than one function in same resource with different httpmethod, So it&#39;s quite possible that on calling same URL with get request you might hit one function whereas calling &#39;put&#39; you might hit another. Details about this will be covered later.
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: yellow; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 15px; line-height: 20px;&quot;&gt;Note:Application name(mapping name from which you registered your REST app) is case IN-sensitive.&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;&amp;lt;- Previous&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.in/2012/02/tutorial-on-restful-services-in.html&quot;&gt;Contents&lt;/a&gt;&lt;/td&gt;
&lt;td width=&quot;33%&quot;&gt;&lt;a href=&quot;http://milanchandnacf.blogspot.com/2012/02/rest-coldfusion10-part2.html&quot;&gt;Next -&amp;gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;hr /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Milan.
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/6016956106557362231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/getting-started-with-rest-in-coldfusion.html#comment-form' title='24 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/6016956106557362231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/6016956106557362231'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/getting-started-with-rest-in-coldfusion.html' title='Getting Started with REST in ColdFusion 10'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3_i2LakbJeSaSq455tK_KhVdzSj7ShjjPduj3OqNBT2doz7vLZESV2DbYfPQln_TOG2eaIHSobHaPYkAA_oKG21zw7biqadwTLo9i7AXL_y7lymfCpoKSFWO7SkcJpdHkYx1ZxKDleD8/s72-c/admin.png" height="72" width="72"/><thr:total>24</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-8704593142309335550</id><published>2012-02-10T04:51:00.001+05:30</published><updated>2012-02-21T23:24:07.535+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="arrayCompare"/><category scheme="http://www.blogger.com/atom/ns#" term="Arrays"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion"/><category scheme="http://www.blogger.com/atom/ns#" term="equate complex types"/><category scheme="http://www.blogger.com/atom/ns#" term="Query"/><category scheme="http://www.blogger.com/atom/ns#" term="queryCompare"/><category scheme="http://www.blogger.com/atom/ns#" term="Struct"/><category scheme="http://www.blogger.com/atom/ns#" term="structCompare"/><category scheme="http://www.blogger.com/atom/ns#" term="Structure"/><title type='text'>Equate arrays, structs, query or possible combination of three</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;



&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Have you ever felt need to compare two arrays in ColdFusion or comparing two structs or may be two queries. If you are reading this, I am sure you felt at some point and if not, you can still read on :)&lt;br /&gt;
&lt;br /&gt;
We use arrays, structs and queries so regularly in ColdFusion that at some point or the other we have to compare them and we dump it to check if its coming fine. Dump is such a powerful tag in ColdFusion that you should use it but what if you want to write a script to check that. Ahhh... cfdump cannot be used there right.&lt;br /&gt;
&lt;br /&gt;
Well not to worry, I have written a code, in fact to be precise I have modified a script (courtesy-&lt;a href=&quot;http://cflib.org/index.cfm?event=page.udfbyid&amp;amp;udfid=1210&quot; target=&quot;_blank&quot;&gt;cflib.org&lt;/a&gt;) which will allow you to compare arrays or structs or queries. Even if you have complex objects like array of struct or array inside struct or query in array of struct or whatever possiblity you can think of these three, you can easily compare using three simple functions: arrayCompare(leftarray, rightarray), structCompare(leftStruct, rightStruct), queryCompare(leftQuery, rightQuery).&lt;br /&gt;
&lt;br /&gt;
I will post complete code n the end, you can save that in .cfm file and call the functions at your will. So it&#39;s like if you have two comparable variabes:array of structs, you just need to pass both of them to arrayCompare() OR if you have complex structs having array or query inside you need to call arrayStruct. Handling of array, struct or query present inside your variable will be automatically taken care of.&lt;br /&gt;
&lt;br /&gt;
If both the variables passed by you are equal then this will return a boolean true else false. Find comments inline to understand the code.&lt;br /&gt;
&lt;br /&gt;
So go ahead, you this file, call functions and compare your complex variables at ease.&lt;br /&gt;
&lt;br /&gt;
Click below given link to see the code: &lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush:cf;highlight:[33,76,128];collapse:true&quot; title=&quot;complexCompare.cfm&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---
This library is part of the Common Function Library Project. An open source
 collection of UDF libraries designed for ColdFusion 5.0 and higher. For more information,
 please see the web site at:

  http://www.cflib.org

 Warning:
 You may not need all the functions in this library. If speed
 is _extremely_ important, you may want to consider deleting
 functions you do not plan on using. Normally you should not
 have to worry about the size of the library.

 License:
 This code may be used freely.
 You may modify this code as you see fit, however, this header, and the header
 for the functions must remain intact.

 This code is provided as is.  We make no warranty or guarantee.  Use of this code is at your own risk.
---&gt;

&lt;cfscript&gt;
/**
 * Recursive functions to compare structures and arrays.
 * Fix by Jose Alfonso.
 * 
 * @param LeftStruct   The first struct. (Required)
 * @param RightStruct   The second structure. (Required)
 * @return Returns a boolean. 
 * @author Ja Carter (ja@nuorbit.com) 
 * @version 2, October 14, 2005 
 */
function structCompare(LeftStruct,RightStruct) {
 //WriteDump(&quot;aya1.......................&quot;, &quot;console&quot;);
 var result = true;
 var LeftStructKeys = &quot;&quot;;
 var RightStructKeys = &quot;&quot;;
 var key = &quot;&quot;;
 
 //Make sure both params are structures
 if (NOT (isStruct(LeftStruct) AND isStruct(RightStruct))) return false;

 //Make sure both structures have the same keys
 LeftStructKeys = ListSort(StructKeyList(LeftStruct),&quot;TextNoCase&quot;,&quot;ASC&quot;);
 RightStructKeys = ListSort(StructKeyList(RightStruct),&quot;TextNoCase&quot;,&quot;ASC&quot;);
 if(LeftStructKeys neq RightStructKeys) return false; 
 
 // Loop through the keys and compare them one at a time
 for (key in LeftStruct) {
  //checking if elements are defined
  if(structKeyExists(LeftStruct,&quot;key&quot;) and structKeyExists(RightStruct,&quot;key&quot;))
  {
   //Key is a structure, call structCompare()
   if (isStruct(LeftStruct[key])){
    result = structCompare(LeftStruct[key],RightStruct[key]);
    //WriteDump(&quot;aya1.......................&quot;, &quot;console&quot;);
    if (NOT result) return false;
   //Key is an array, call arrayCompare()
   } else if (isArray(LeftStruct[key])){
    result = arrayCompare(LeftStruct[key],RightStruct[key]);
    //WriteDump(&quot;nahi fata..................&quot;, &quot;console&quot;);
    if (NOT result) return false;
   //Key is a query, call queryCompare()
   } else if (isQuery(LeftStruct[key])){
    result = queryCompare(LeftStruct[key],RightStruct[key]);
    if (NOT result) return false;
   // A simple type comparison here
   } else {
    if(LeftStruct[key] IS NOT RightStruct[key]) return false;
   }
  } else if((structKeyExists(LeftStruct,&quot;key&quot;) and (not structKeyExists(RightStruct,&quot;key&quot;))) or ((not structKeyExists(LeftStruct,&quot;key&quot;)) and structKeyExists(RightStruct,&quot;key&quot;))) return false;
 }
 return true;
}

function arrayCompare(LeftArray,RightArray) {
 var result = true;
 var i = &quot;&quot;;
 
 
 //Make sure both params are arrays
 if (NOT (isArray(LeftArray) AND isArray(RightArray))) return false;
 
 //Make sure both arrays have the same length
 if (NOT arrayLen(LeftArray) EQ arrayLen(RightArray)) return false;
 
 // Loop through the elements and compare them one at a time
 for (i=1;i lte arrayLen(LeftArray); i = i+1) {
 
  //checking if elements are defined
  //if(isDefined(&quot;LeftArray[i]&quot;) and isDefined(&quot;RightArray[i]&quot;))
  //{
  leftArray[i] = checkArrayElement(leftArray,i);
 
  RightArray[i] = checkArrayElement(RightArray,i);
  
  //if ( not(result1 eq result2))
   //return false;
 
  //if((result1 eq false) and (result2 eq false))
   //continue;
 
  //elements is a structure, call structCompare()
  if (isStruct(LeftArray[i])){
   result = structCompare(LeftArray[i],RightArray[i]);
   if (NOT result) return false;
  
 
  //elements is an array, call arrayCompare()
  } else if (isArray(LeftArray[i])){
   result = arrayCompare(LeftArray[i],RightArray[i]);
   if (NOT result) return false;
  //elements is a query, call queryCompare()
  } else if (isQuery(LeftArray[i])){
   result = queryCompare(LeftArray[i],RightArray[i]);
   if (NOT result) return false;
  //A simple type comparison here
  } else {
   if(LeftArray[i] IS NOT RightArray[i]) return false;
  }
  //} else if((isDefined(&quot;LeftArray[i]&quot;) and (not isDefined(&quot;RightArray[i]&quot;))) or ((not isDefined(&quot;LeftArray[i]&quot;)) and isDefined(&quot;RightArray[i]&quot;))) return false;
 }
 
 return true;
}
&lt;/cfscript&gt;

&lt;cffunction name=&quot;queryCompare&quot; returntype=&quot;boolean&quot; output=&quot;false&quot;&gt;
 &lt;cfargument name=&quot;query1&quot; type=&quot;query&quot; required=&quot;true&quot; /&gt;
 &lt;cfargument name=&quot;query2&quot; type=&quot;query&quot; required=&quot;true&quot; /&gt;

    &lt;cfset CompareArray1 = QueryToArray(query1)&gt;
    &lt;cfset CompareArray2 = QueryToArray(query2)&gt;
    &lt;cfreturn arrayCompare(CompareArray1,CompareArray2)&gt;
&lt;/cffunction&gt;

&lt;cffunction name=&quot;QueryToArray&quot; access=&quot;public&quot; returntype=&quot;array&quot; output=&quot;false&quot; hint=&quot;This turns a query into an array of structures.&quot;&gt;

&lt;!--- Define arguments. ---&gt;
&lt;cfargument name=&quot;Data&quot; type=&quot;query&quot; required=&quot;yes&quot; /&gt;

&lt;cfscript&gt;

// Define the local scope.
var LOCAL = StructNew();

// Get the column names as an array.
LOCAL.Columns = ListToArray( ARGUMENTS.Data.ColumnList );

// Create an array that will hold the query equivalent.
LOCAL.QueryArray = ArrayNew( 1 );

// Loop over the query.
for (LOCAL.RowIndex = 1 ; LOCAL.RowIndex LTE ARGUMENTS.Data.RecordCount ; LOCAL.RowIndex = (LOCAL.RowIndex + 1)){

// Create a row structure.
LOCAL.Row = StructNew();

// Loop over the columns in this row.
for (LOCAL.ColumnIndex = 1 ; LOCAL.ColumnIndex LTE ArrayLen( LOCAL.Columns ) ; LOCAL.ColumnIndex = (LOCAL.ColumnIndex + 1)){

// Get a reference to the query column.
LOCAL.ColumnName = LOCAL.Columns[ LOCAL.ColumnIndex ];

// Store the query cell value into the struct by key.
LOCAL.Row[ LOCAL.ColumnName ] = ARGUMENTS.Data[ LOCAL.ColumnName ][ LOCAL.RowIndex ];

}

// Add the structure to the query array.
ArrayAppend( LOCAL.QueryArray, LOCAL.Row );

}

// Return the array equivalent.
return( LOCAL.QueryArray );

&lt;/cfscript&gt;
&lt;/cffunction&gt;

&lt;cffunction name=&quot;checkArrayElement&quot; returntype=&quot;any&quot; output=&quot;false&quot;&gt;
 &lt;cfargument name=&quot;array&quot; type=&quot;any&quot; required=&quot;false&quot; /&gt;
 &lt;cfargument name=&quot;arrayIndex&quot; type=&quot;any&quot; required=&quot;false&quot; /&gt;
 &lt;cfparam name=&quot;array[arrayIndex]&quot; default=&quot;Not Defined&quot;&gt;
 &lt;cfreturn array[arrayIndex]&gt;
&lt;/cffunction&gt;
&lt;/script&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
This code is also available at cflib.org but I have modified it according to the need, so it might not be the same. If you are looking for a complete set of three features(array, struct, query compare) this file is perfect for you.&lt;br /&gt;
&lt;br /&gt;
Share if you feel its worth it. Comments will be a +1.
&lt;br /&gt;
&lt;br /&gt;
-Milan Chandna&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/8704593142309335550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/equate-arrays-structs-query-or-possible.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/8704593142309335550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/8704593142309335550'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/equate-arrays-structs-query-or-possible.html' title='Equate arrays, structs, query or possible combination of three'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-6161307649949535830</id><published>2012-02-04T02:14:00.000+05:30</published><updated>2012-02-28T00:56:45.738+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="cfloop"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion"/><category scheme="http://www.blogger.com/atom/ns#" term="continue"/><category scheme="http://www.blogger.com/atom/ns#" term="loop"/><title type='text'>Continue in cfloop</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;



&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Have you ever used continue in cfloop without cfcontinue/cfbreak. &lt;br /&gt;
&lt;br /&gt;
Check this code:&lt;/div&gt;
&lt;/div&gt;
&lt;script class=&quot;brush:cf;highlight:[8,13]&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cfloop from=1 to=10 index=i&gt;
 &lt;cftry&gt;
  &lt;!--- print the no. ---&gt;
  &lt;cfoutput&gt;#i#&lt;/cfoutput&gt;
  &lt;!--- if the no. is even then throw a custom error ---&gt;
  &lt;!--- this block is acting as continue ---&gt;
  &lt;cfif i%2 eq 0&gt;
   &lt;cfthrow type=&quot;even&quot; &gt;
  &lt;/cfif&gt;
  &lt;!--- something more that I want to do with odd no.s ---&gt;
  &lt;!--- even no.s will not reach here as an error is thrown for them already ---&gt;
  &lt;cfoutput&gt; : this is an odd no.&lt;/cfoutput&gt;
  &lt;cfcatch type=&quot;even&quot;&gt;
   &lt;!--- even no.s will be caught here ---&gt;
   &lt;!--- i can add my code for them ---&gt;
   &lt;!--- otherwise I can just close catch before &lt;/cfloop&gt; ---&gt;
   &lt;!--- it will act as continue then ---&gt;
  &lt;/cfcatch&gt;
 &lt;/cftry&gt;
&lt;/cfloop&gt;
&lt;/script&gt;

&lt;br /&gt;
Here I have a &amp;lt;cfloop&amp;gt; which runs 10 times for value of &#39;i&#39;.&amp;nbsp;I want to implement continue tag if the &#39;i&#39; is an even no.&amp;nbsp;To achieve that check if the no.is even and if it is, I throw a custom error.&lt;br /&gt;
&lt;br /&gt;
The good thing is that you can always catch this error. So Catch this error before closing &amp;lt;/cfloop&amp;gt; tag. Though you can add some code over there also but it totally depends on you. For a normal continue you need not add anything in &amp;lt;cfcatch&amp;gt; block. As expected this thrown error wil be caugth in &amp;lt;cfcatch&amp;gt; and it will proceed for next iteration in &amp;lt;cfloop&amp;gt;, without any error. And this is how it behaved as continue.&lt;br /&gt;
&lt;br /&gt;
So all in all you need to remember that&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;instead of continue you can throw a custom error&lt;/li&gt;
&lt;li&gt;catch this error in the end (before closing &amp;lt;/cfloop&amp;gt; tag)&lt;/li&gt;
&lt;li&gt;Do nothing in &amp;lt;cfcatch&amp;gt; tag (though its your wish but its not necessary)&lt;/li&gt;
&lt;li&gt;close &amp;lt;/cfloop&amp;gt; tag.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Hope you got this.&lt;/div&gt;
&lt;div&gt;
Cheers!!!&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/6161307649949535830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/continue-in-cfloop.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/6161307649949535830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/6161307649949535830'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/02/continue-in-cfloop.html' title='Continue in cfloop'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-8191385189645770527</id><published>2012-01-26T01:49:00.000+05:30</published><updated>2012-01-26T01:54:15.456+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CF theme"/><category scheme="http://www.blogger.com/atom/ns#" term="Chrome"/><category scheme="http://www.blogger.com/atom/ns#" term="Chrome theme"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion Blogs"/><category scheme="http://www.blogger.com/atom/ns#" term="cool blue CF theme"/><category scheme="http://www.blogger.com/atom/ns#" term="Theme"/><title type='text'>ColdFusion Chrome theme</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
Oh Yes, All the ColdFusion lovers who use Chrome Browser for their work or their day to day stuff can now load CF theme from &lt;a href=&quot;http://blogs.coldfusion.com/assets/content/cf%20theme.crx&quot;&gt;&lt;b&gt;HERE&lt;/b&gt;&lt;/a&gt;(created by me) into chrome and feel close to CF always. Cheers!!!&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Well I will not write much about this as there is already a blog written for it and I will just redirect you ;)&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://blogs.coldfusion.com/post.cfm/chrome-coldfusion-theme&quot;&gt;http://blogs.coldfusion.com/post.cfm/chrome-coldfusion-theme&lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Share, Like and Tweet if you like this.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Milan.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/8191385189645770527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2012/01/coldfusion-chrome-theme.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/8191385189645770527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/8191385189645770527'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2012/01/coldfusion-chrome-theme.html' title='ColdFusion Chrome theme'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-3953436400546325832</id><published>2011-10-03T02:08:00.000+05:30</published><updated>2012-02-04T02:22:20.030+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="authentication"/><category scheme="http://www.blogger.com/atom/ns#" term="authorized"/><category scheme="http://www.blogger.com/atom/ns#" term="axis"/><category scheme="http://www.blogger.com/atom/ns#" term="cfinvoke"/><category scheme="http://www.blogger.com/atom/ns#" term="cflogin"/><category scheme="http://www.blogger.com/atom/ns#" term="cfobject"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion"/><category scheme="http://www.blogger.com/atom/ns#" term="consumed"/><category scheme="http://www.blogger.com/atom/ns#" term="HTTP basic authentication"/><category scheme="http://www.blogger.com/atom/ns#" term="isAuthorized"/><category scheme="http://www.blogger.com/atom/ns#" term="password"/><category scheme="http://www.blogger.com/atom/ns#" term="published"/><category scheme="http://www.blogger.com/atom/ns#" term="secured"/><category scheme="http://www.blogger.com/atom/ns#" term="username"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><title type='text'>Secured Web Services in ColdFusion</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;



&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
One day I just felt the need to create a Secured ColdFusion Web Service and to my wonder I just found good examples of consuming it but none for publishing it. That influenced me to write a &amp;nbsp;blog for Web Service published in ColdFusion, consumed in ColdFusion and that too in a secured manner using &amp;lt;cfinvoke&amp;gt;/&amp;lt;cfobject&amp;gt; &amp;nbsp;username/password feature.&lt;br /&gt;
&lt;br /&gt;
Without giving the overview I will just get into the details but before that it&#39;s must to understand that how is ColdFusion behaving from client side . From client side when you give username/password in &amp;lt;cfinvoke&amp;gt; tag or &amp;lt;cfobject&amp;gt; tag (see the sample code below), then ColdFusion sends the information as part of the request. The login information is passed to web server using HTTP basic authentication.  
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush:cf;highlight:[2,6]&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;!---using cfinvoke to consume web service with username and password---&gt;
&lt;cfinvoke method=&quot;authenticate&quot; password=&quot;coldfusion&quot; refreshwsdl=&quot;true&quot; returnvariable=&quot;res&quot; username=&quot;adobe&quot; webservice=&quot;#webservice_url#&quot;&gt;
&lt;/cfinvoke&gt;

&lt;!---using cfobject to consume web service with username and password---&gt;
&lt;cfobject name=&quot;ws&quot; password=&quot;coldfusion&quot; username=&quot;adobe&quot; webservice=&quot;#webservice_url#&quot; /&gt;
&lt;cfset res=&quot;ws.authenticate()&quot; /&gt;
&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
Please note that these are just code snippets. I will share the complete code in the end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You just saw how easy it is to consume a web service in ColdFusion. Publishing also is a very simple task but there is a twist. ColdFusion doesn&#39;t give any specific feature to handle the authentication (username/password) sent by client-side(using cfinvoke/cfobject). But that doesn&#39;t mean you can not handle it. ColdFusion has already given an awesome feature of &amp;lt;cflogin&amp;gt; and expects the user to authenticate the credentials using that same feature.&lt;br /&gt;
&lt;br /&gt;
Here is snippet of &amp;lt;cflogin&amp;gt; authentication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush:cf&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cflogin&gt;
 &lt;!---setting isAuthorized as false so that it doesn&#39;t remeber the previous result---&gt;
 &lt;cfset isAuthorized = false&gt;
 &lt;!---if username/password will be sent in request then cflogin will get defined automatically---&gt;
 &lt;cfif isDefined(&quot;cflogin&quot;)&gt;
  &lt;!---dumping the cflogin structure at console, but you should not do this in production server---&gt;
  &lt;cfdump output=&quot;console&quot; var=&quot;#cflogin#&quot;&gt;
  &lt;!---checking for authorization of username and password---&gt;
  &lt;cfif (cflogin.name eq &quot;adobe&quot;) and (cflogin.password eq &quot;coldfusion&quot;)&gt;
   &lt;!---if authorized then isAuthorized is set---&gt;
   &lt;cfset isAuthorized = true&gt;
  &lt;cfelse&gt;
   &lt;!---if not authorized then UnAuthorized code is sent back to browser---&gt;
   &lt;cfheader statuscode=&quot;401&quot;&gt;
   &lt;!---further processing is aborted---&gt;
   &lt;cfabort&gt;
  &lt;/cfif&gt;
 &lt;/cfif&gt;
&lt;/cflogin&gt;
&lt;/script&gt;

&lt;/div&gt;
&lt;br /&gt;
Please read the comments inline to understand the code.&lt;br /&gt;
&lt;br /&gt;
We just saw how to catch the username and password sent in request by cfinvoke but the question is where to use it. I will suggest to use this code in Application.cfc instead of web service component. The reason is, it could save you a lot of code rewriting and easy to maintain. You can just write the code once in Application.cfc in onRequestStart() method and for every request it will ask for authorization otherwise will &amp;nbsp;send UnAuthorized status.&lt;br /&gt;
&lt;br /&gt;
I hope you got an idea of how to consume a web-service with credentials and how to publish a web-service which gives on access on proper authorization.&lt;br /&gt;
&lt;br /&gt;
So now I will post the complete code for doing this. There will be three files namely: securedws.cfm,&amp;nbsp;securedws.cfc and Application.cfc. I am assuming that ColdFusion9(installed in C:\) is used and these files are kept under C:/coldfusion9/wwwroot/securedwebservices/&lt;br /&gt;
Please change the URL of webservices in code given below accordingly if your configuration is different.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class=&quot;brush:cf;title:[securedws.cfm]&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cfset wsdlurl = &quot;http://127.0.0.1:8500/securedwebservices/securedws.cfc?wsdl&quot;&gt;


&lt;!---using cfobject to consume a secured web service---&gt;
&lt;cfobject name=&quot;ws&quot; username=&quot;adobe&quot; password=&quot;coldfusion&quot; webservice=&quot;#wsdlurl#&quot;&gt;
&lt;cfset res = ws.authenticate()&gt;

&lt;cfdump var=&quot;#res#&quot;&gt;
&lt;!----------------------------------------------------&gt;

&lt;!---using cfinvoke to consume a secured web service---&gt;
&lt;cfinvoke webservice=&quot;#wsdlurl#&quot; username=&quot;adobe&quot; password=&quot;coldfusion&quot; method=&quot;authenticate&quot; returnvariable=&quot;res&quot; refreshwsdl=&quot;true&quot;&gt;

&lt;cfdump var=&quot;#res#&quot;&gt;
&lt;!----------------------------------------------------&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush:cf;title:[Application.cfc]&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cfcomponent&gt;
 &lt;cffunction name=&quot;onRequestStart&quot;&gt;
  &lt;cflogin&gt;
   &lt;cfset isAuthorized = false&gt;
   &lt;cfif isDefined(&quot;cflogin&quot;)&gt;
    &lt;!---&lt;cfdump output=&quot;console&quot; var=&quot;#cflogin#&quot;&gt;---&gt;
    &lt;cfif (cflogin.name eq &quot;adobe&quot;) and (cflogin.password eq &quot;coldfusion&quot;)&gt;
     &lt;cfset isAuthorized = true&gt;
    &lt;cfelse&gt;
     &lt;cfheader statuscode=&quot;401&quot;&gt;
     &lt;cfabort&gt;
    &lt;/cfif&gt;
   &lt;/cfif&gt;
  &lt;/cflogin&gt;
  &lt;cfreturn /&gt;
  &lt;cfif not isAuthorized&gt;
   &lt;!--- If the user does not pass a user name/password, return a 401 error. 
   The browser then prompts the user for a user name/password. ---&gt;
   &lt;cfheader statuscode=&quot;401&quot;&gt;
   &lt;cfheader name=&quot;WWW-Authenticate&quot; value=&quot;Basic realm=&quot;&quot;Test&quot;&quot;&quot;&gt;
   &lt;cfabort&gt;
  &lt;/cfif&gt;
 &lt;/cffunction&gt;
&lt;/cfcomponent&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush:cf;title:[securedws.cfc]&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;cfcomponent &gt;
 &lt;cffunction name=&quot;authenticate&quot; access=&quot;remote&quot; returntype=&quot;String&quot; &gt;

  &lt;cfreturn &quot;Welcome!!!&quot;&gt;
 &lt;/cffunction&gt;
&lt;/cfcomponent&gt;
&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note that for consuming the web-services always prefer &amp;lt;cfinvoke&amp;gt; tag over &amp;lt;cfobject&amp;gt;. cfobject tag has one limitation, it caches the first username/password and then even if you will change the credentials, it will send the first credentials only.&lt;br /&gt;
&lt;br /&gt;
For example, consider that there are two users for your webservice with two credentials lets say: user1/pass1 and user2/pass2.&lt;br /&gt;
&lt;br /&gt;
First lets use cfobject with credentials of first user(user1/pass1) and try to access the web-service. It will send the correct credentials to web-service. Now change the credentials in the same cfobject and use second user&#39;s one(user2/pass2) and access the webservice. This time request should have send second user&#39;s credentials(user2/pass2) but it actually passes (user1/pass1). You can confirm this behavior using &amp;lt;cfdump output=&quot;console&quot; var=&quot;#cflogin#&quot;&amp;gt; at server side.&lt;br /&gt;
&lt;br /&gt;
This behavior is only observed with cfobject only and is quite dangerous. So I will suggest you to use cfinvoke.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Feel free to post any queries.&lt;br /&gt;
&lt;br /&gt;
ColdFusion Rocks!!!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/3953436400546325832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2011/10/creating-secured-web-services-in.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3953436400546325832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/3953436400546325832'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2011/10/creating-secured-web-services-in.html' title='Secured Web Services in ColdFusion'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3225763195468554727.post-4325016110090343153</id><published>2011-09-30T05:40:00.000+05:30</published><updated>2012-02-04T02:22:34.237+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="axis"/><category scheme="http://www.blogger.com/atom/ns#" term="client-config.wsdd"/><category scheme="http://www.blogger.com/atom/ns#" term="ColdFusion"/><category scheme="http://www.blogger.com/atom/ns#" term="handler"/><category scheme="http://www.blogger.com/atom/ns#" term="Logger"/><category scheme="http://www.blogger.com/atom/ns#" term="request"/><category scheme="http://www.blogger.com/atom/ns#" term="requestFlow"/><category scheme="http://www.blogger.com/atom/ns#" term="response"/><category scheme="http://www.blogger.com/atom/ns#" term="responseFlow"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><category scheme="http://www.blogger.com/atom/ns#" term="sign"/><category scheme="http://www.blogger.com/atom/ns#" term="web services"/><category scheme="http://www.blogger.com/atom/ns#" term="wsdd"/><title type='text'>Add Handler to ColdFusion web services</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;



&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Well first of all lets understand what does adding Handler to ColdFusion web services mean. As the name suggests, you can create and add your class/function in such a way that whenever there is a request/response to ColdFusion soap based web service, your class/function will be called.&lt;br /&gt;
&lt;br /&gt;
Lets understand it from an example.&lt;br /&gt;
You created a service in ColdFusion, but you want your program &#39;Logger&#39; to be called for every request/response so that you can log the service in your own way. Well as the ColdFusion already gives you logging handlers so lets take a good example.&lt;br /&gt;
&lt;br /&gt;
What if you want to digitally sign your soap messages before sending them through ColdFusion. Its easy, I would suggest to use Apache xml security library and write a simple program in Java to do that. But the twist is how to call that java class everytime you send a soap response in ColdFusion. Well there is the need to add the handlers in ColdFusion web service. So here we go trying our hand at it.&lt;br /&gt;
&lt;br /&gt;
Just follow few easy steps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Create a simple web service in ColdFusion and try to invoke it. See if its working fine and you are getting the expected result.&amp;nbsp;Now open client-config.wsdd kept in {coldfusion_webroot}\WEB-INF\ folder.&amp;nbsp;Take a back-up of this .wsdd and keep it safe. Open this wsdd in notepad and if you will notice, this .wsdd file is in xml format.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;I will give you a snippet of wsdd file which I have modified.&lt;/li&gt;
&lt;br /&gt;

&lt;pre class=&quot;brush: xml;highlight:[4,10,14];title:[client-config.wsdd];collapse:true&quot;&gt;&lt;deployment xmlns:java=&quot;http://xml.apache.org/axis/wsdd/providers/java&quot; xmlns=&quot;http://xml.apache.org/axis/wsdd/&quot;&gt;
 &lt;handler name=&quot;log&quot; type=&quot;java:org.apache.axis.handlers.LogHandler&quot;&gt;
&lt;handler name=&quot;myClass&quot; type=&quot;java:myClassName&quot;&gt;
 &lt;globalconfiguration&gt;
  
  

  &lt;requestflow&gt;
 &lt;handler type=&quot;myClass&quot;&gt;
   
  &lt;/handler&gt;&lt;/requestflow&gt;
  &lt;responseflow&gt;
 &lt;handler type=&quot;myClass&quot;&gt;

  &lt;/handler&gt;&lt;/responseflow&gt;
.
.
.


&lt;/globalconfiguration&gt;&lt;/handler&gt;&lt;/handler&gt;&lt;/deployment&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;li&gt;Check out what all has been mofified in this client-config.wsdd file. First of all look for&amp;nbsp;&amp;lt;requestFlow&amp;gt; tag element in this file(usually this will be the child element of &amp;lt;globalConfiguration&amp;gt; element and will be commented by default). If&amp;nbsp;&amp;lt;requestFlow&amp;gt;&amp;nbsp;is commented then remove the comments around it and add this line in between &amp;lt;requestFlow&amp;gt; opening and closing tags:&amp;nbsp;&amp;lt;handler type=&quot;myClass&quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;Also notice that there will be one handler already present in it:&amp;nbsp;&amp;lt;handler type=&quot;log&quot;/&amp;gt;. This is ColdFusion&#39;s handler to log the requests. You can remove this log handler if you do not want your services to be logged(specially in production servers). Just comment this particular handler eg: &amp;lt;!--&amp;nbsp;&amp;lt;handler type=&quot;log&quot;/&amp;gt; --&amp;gt;&lt;/li&gt;
&lt;li&gt;After doing this much there just one more line to be added in this wsdd file. &amp;nbsp;Notice that there is a &amp;lt;deployment&amp;gt; element tag in the beginning of file and its child is &amp;lt;handler&amp;gt; element tag. This handler is provided by ColdFusion for the very same purpose of logging. We will add our handler somewhat similar to ColdFusion&#39;s handler:&amp;nbsp;&amp;lt;handler name=&quot;myClass&quot; type=&quot;java:myClassName&quot;/&amp;gt;. You can add this just beneath handler provided by ColdFusion.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Save this client-config.wsdd file and we are half way done. Now lets create one sample class for testing this and we will keep its name as myClassName.java, as we have given this very same name in wsdd file. You can choose whatever name you like but make sure to give the same name in handler. You can also make package but you need to keep it in similar manner in wsdd too eg:&amp;nbsp;&amp;lt;handler name=&quot;myClass&quot; type=&quot;java:myPackageName.myClassName&quot;/&amp;gt;.&lt;/li&gt;
&lt;li&gt;&lt;div&gt;
Just as I explained the steps to add the handler in &amp;lt;requestFlow&amp;gt; in client-config.wsdd file, similarly you can also add a handler for &amp;lt;responseFlow&amp;gt; so that you can catch the reponses as well.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;/ul&gt;
&lt;div&gt;
I will share a very simple code of java which creates one file in local directory so that we can keep a check that this method is getting called everytime web service is hit, by looking at the timetsamp of file created.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: java;title:[myClassName.java];collapse:true&quot;&gt;&lt;code&gt;//java code
import java.io.*;
import org.apache.axis.handlers.*;
import org.apache.axis.*;

public class myClassName extends BasicHandler
{
 public void init()
 {
  super.init();
  System.out.println(&quot;init is called&quot;);
 }

 public void createFile() {
  try{
  File f;
  f=new File(&quot;D:\\sample.txt&quot;);
  if(!f.exists())
  {
   f.createNewFile();
   //New file has been created to the specified directory
  }
  }catch(IOException e)
  {e.printStackTrace();}
 }

 public void invoke(MessageContext mCtx) throws AxisFault {
  try {
   this.createFile();
  } 
  catch (Exception e) {
   e.printStackTrace();
  }
 }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;/div&gt;
&lt;div&gt;
Compile this program and keep the class file in {ColdFusion_documentroot}\lib\&lt;/div&gt;
&lt;div&gt;
Usually it will be C:\ColdFusion9\lib\&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Understanding myClassname.java&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;First of all I have imported few axis classes which are required for handler&lt;/li&gt;
&lt;li&gt;I have also extended the class with BasicHandler class of axis. This class is present in org.apache.xml.handlers.* in axis.jar (found in {ColdFusion_documentroot}\lib folder)&lt;/li&gt;
&lt;li&gt;This BasicHandler is an abstract class with invoke(MessageContext) as abstract method which is why its necessary to implement this method. This method throws AxisFault Exception. You can use this method for whatever you have to implement,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Other than this we have also written init() method. This method will be called first time when your handler(myClassName) will be called.&lt;/li&gt;
&lt;li&gt;You can extend this program&#39;s functionality to whatever you want.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Well that is it.&lt;/div&gt;
&lt;div&gt;
Just restart the server(as we have added myClassname.class in lib folder) and access the web service created by you, you will see the file created successfully.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
This way you can add whatever handler you want and as ColdFusion web services are based on Axis, you can take strong benefits of Axis library and do whatever you want with your web services in ColdFusion.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Feel free to post any queries.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ColdFusion Rocks!!!&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://milanchandnacf.blogspot.com/feeds/4325016110090343153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://milanchandnacf.blogspot.com/2011/09/adding-handler-to-coldfusion-web.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/4325016110090343153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3225763195468554727/posts/default/4325016110090343153'/><link rel='alternate' type='text/html' href='http://milanchandnacf.blogspot.com/2011/09/adding-handler-to-coldfusion-web.html' title='Add Handler to ColdFusion web services'/><author><name>Milan Chandna</name><uri>http://www.blogger.com/profile/03845509070175437860</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfkddoRsNS3D7YuTKnXrYVIy2w9wpoookkCeqZrVFwDnSkiRKSyPXiuX6CdOuKBqCY1tyjp45QqMdTDw15E0utXEqxg5g6HnR53JVi457mBCjqdaRnZm0LhFxwZPcby6U/s220/164745_10150122762075934_587360933_7884065_6329455_n.jpg'/></author><thr:total>4</thr:total></entry></feed>