<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>/bin/recykl</title>
	<atom:link href="https://blog.zmok.net/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.zmok.net</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 17 Nov 2010 12:28:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.2</generator>
	<item>
		<title>Anatomy of a successful project</title>
		<link>https://blog.zmok.net/articles/2010/04/01/anatomy-of-a-successful-project</link>
					<comments>https://blog.zmok.net/articles/2010/04/01/anatomy-of-a-successful-project#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Thu, 01 Apr 2010 09:33:42 +0000</pubDate>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[project management]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2010/04/01/anatomy-of-a-successful-project</guid>

					<description><![CDATA[Starting a new project is always an exciting time. People are discussing the &#8220;NEW BIG THING&#8221;, putting together their two cents to fully utilize the budget, dreaming&#8230; Stakeholder says: &#8220;It has to rock! It must create us a competitive advantage!&#8221; Project sponsor: &#8220;Sure, but it has to be cheap.&#8221; Analyst shouts: &#8220;We should not underestimate&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2010/04/01/anatomy-of-a-successful-project">Continue reading <span class="screen-reader-text">Anatomy of a successful project</span></a>]]></description>
										<content:encoded><![CDATA[<p>Starting a new project is always an exciting time. People are discussing the &#8220;NEW BIG THING&#8221;, putting together their two cents to fully utilize the budget, dreaming&#8230;<br />
Stakeholder says: &#8220;It has to rock! It must create us a competitive advantage!&#8221;<br />
Project sponsor: &#8220;Sure, but it has to be cheap.&#8221;<br />
Analyst shouts: &#8220;We should not underestimate the requirements!&#8221;<br />
Architect whispers to developer: &#8220;Architecture is important!&#8221;<br />
Developer whispers back: &#8220;There is a great new framework there. It does not suffer of&#8230; you know, the thing that almost killed us last time.&#8221;<br />
All of these are valid inputs, but to start a successful project, it is important to know its phases. So, let&#8217;s describe it on a simple project that should solve business trips to Paris.
</p>
<ul>
<li>Customer describes the most important use cases: &#8220;I travel to Paris a lot. It would be great to fly there.&#8221;</li>
<li>Analyst remarks requirement: &#8220;Customer wants an airplane.&#8221;</li>
<li>Analyst creates a vision and presents it to the stakeholder. User gets Powerpoint presentation. Both are excited!</li>
<li>Company puts together a tender committee to select the airplane.</li>
<li>Tender committee describes the airplane&#8230; It requires at least 50 seats&#8230; to be sure, it covers future requirements.</li>
<li>Vendors create proposals to deliver the airplane.</li>
<li>Tender committee selects two of them for price negotiations.</li>
<li>Vendors are pushed to cut down price. Tender committee sacrifices the 50 seats and few other non-important features.</li>
<li>Vendors describe a bicycle for price of a car, calling it &#8220;Low elevation flyer (TM)&#8221;.</li>
<li>Tender committee and architects accept it as a temporary solution.</li>
<li>Negotiations were too long, so there is no time to implement. Vendor buys a bicycle, colors it red, stick a pair of bird wings on it and delivers.</li>
<li>Rollout and success! Celebration needed.</li>
<li>End users start to whisper, that it does not fly and it is extremely slow.</li>
<li>Vendor provides a bunch of performance tuning and usability experts and forms a task force.</li>
<li>The task force adds a textile wings, propeller, powerful 2000 RP<sup>1</sup> engine and a name &#8220;TURBO low elevation flyer (TM)&#8221;</li>
<li>Even greater success! Celebration needed, press release absolutely necessary.</li>
<li>End users start to use train.</li>
</ul>
<p>Now it is obvious: &#8220;It is not important what you do, but how you present it&#8221;</p>
<p>Happy All Fools&#8217; Day!</p>
<p>
<sup>1.</sup> 2000 RP &#8211; 2000 ratpowers. It is like horsepower, but it looks better to see 2000 RP than 2 HP.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2010/04/01/anatomy-of-a-successful-project/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Nested set plugin for Grails</title>
		<link>https://blog.zmok.net/articles/2010/03/25/nested-set-plugin-for-grails</link>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Thu, 25 Mar 2010 08:34:55 +0000</pubDate>
				<category><![CDATA[Open source]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[hierarchical data]]></category>
		<category><![CDATA[nested set]]></category>
		<category><![CDATA[plugin]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2010/03/25/nested-set-plugin-for-grails</guid>

					<description><![CDATA[We are happy to announce that our NestedSet plugin for the Grails framework has been released. The plugin creates a hierarchical structure on top of plain database records. A description of the &#8220;nested set&#8221; data structure can be found in Wikipedia. The NestedSet Grails plugin is non-intrusive &#8211; it does not change your data model,&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2010/03/25/nested-set-plugin-for-grails">Continue reading <span class="screen-reader-text">Nested set plugin for Grails</span></a>]]></description>
										<content:encoded><![CDATA[<p>We are happy to announce that our NestedSet plugin for the Grails framework has been released. The plugin creates a hierarchical structure on top of plain database records. A description of the &#8220;nested set&#8221; data structure can be found in <a href="http://en.wikipedia.org/wiki/Nested_set_model">Wikipedia</a>. </p>
<p>The NestedSet Grails plugin is </p>
<ul>
<li><strong>non-intrusive</strong> &#8211; it does not change your data model, just adds one table</li>
<li><strong>easy to use</strong> &#8211; just add &#8220;<em>static nestedSet = true</em>&#8221; to the domain class</li>
<li><strong>versatile</strong> &#8211; it supports multiple hierarchies</li>
</ul>
<p>Installation instructions and usage details can be found at the <a href="http://www.grails.cz/projects/grailsnestedset/wiki"><strong>NestedSet plugin homepage</strong></a>. </p>
<p>
If you find it useful, tell your friends. If there is a problem, please register at <a href="http://www.grails.cz/account/register"><strong>grails.cz</strong></a> and create a new issue.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SoapUI in IntelliJ IDEA 8.1.3</title>
		<link>https://blog.zmok.net/articles/2009/09/02/soapui-in-intellij-idea-813</link>
					<comments>https://blog.zmok.net/articles/2009/09/02/soapui-in-intellij-idea-813#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 01 Sep 2009 22:16:07 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[web services]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2009/09/02/soapui-in-intellij-idea-813</guid>

					<description><![CDATA[The latest and greatest IntelliJ IDEA 8.1.3, a cute Java IDE, has soapUI integrated as a plugin. That&#8217;s a handy open-source helper for developing and testing SOAP-based web services. However, after installing the plugin and starting it from Tools &#8211; SoapUI &#8211; Start SoapUI, you can only see the soapUI Navigator tool window, showing the&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2009/09/02/soapui-in-intellij-idea-813">Continue reading <span class="screen-reader-text">SoapUI in IntelliJ IDEA 8.1.3</span></a>]]></description>
										<content:encoded><![CDATA[<p>The latest and greatest IntelliJ IDEA 8.1.3, a cute Java IDE, has soapUI integrated as a plugin. That&#8217;s a handy open-source helper for developing and testing SOAP-based web services. </p>
<p>However, after installing the plugin and starting it from Tools &#8211; SoapUI &#8211; Start SoapUI, you can only see the soapUI Navigator tool window, showing the project structure. You can not see or invoke the famous two-pane SoapUI ModelItem Editor displaying SOAP request-response pairs (at least in MS Windows).</p>
<p>A brief check of the soapUI Log &#8211; error log discovers that a class named RSyntaxTextArea cannot be found:</p>
<blockquote><p>java.lang.NoClassDefFoundError: org/fife/ui/rsyntaxtextarea/RSyntaxTextArea</p></blockquote>
<p>That&#8217;s easily helped: just download <a href="http://fifesoft.com/rsyntaxtextarea/">RSyntaxTextArea</a> from the <a href="http://sourceforge.net/projects/rsyntaxtextarea/">SourceForge</a> and copy </p>
<blockquote><p>rsyntaxtextarea.jar</p></blockquote>
<p> to </p>
<blockquote><p>%%USERPROFILE%%\.IntelliJIdea80\config\plugins\intellij-soapui-plugin\lib</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2009/09/02/soapui-in-intellij-idea-813/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Playing with Grails application configuration</title>
		<link>https://blog.zmok.net/articles/2009/04/22/playing-with-grails-application-configuration</link>
					<comments>https://blog.zmok.net/articles/2009/04/22/playing-with-grails-application-configuration#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Wed, 22 Apr 2009 19:48:55 +0000</pubDate>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2009/04/22/playing-with-grails-application-configuration</guid>

					<description><![CDATA[This small tutorial will show how to create a configuration file and how to manage configuration of your Grails application. It will show how to Access configuration parameters Create external configuration Configure Spring for different environments Create a new environment Accessing configuration parameters The configuration of Grails is stored in grails-app/conf directory. Parameters are stored&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2009/04/22/playing-with-grails-application-configuration">Continue reading <span class="screen-reader-text">Playing with Grails application configuration</span></a>]]></description>
										<content:encoded><![CDATA[<p>This small tutorial will show how to create a configuration file and how to manage configuration of your Grails application. It will show how to</p>
<ul>
<li>Access configuration parameters</li>
<li>Create external configuration</li>
<li>Configure Spring for different environments</li>
<li>Create a new environment</li>
</ul>
<h2>Accessing configuration parameters</h2>
<p>The configuration of Grails is stored in grails-app/conf directory. Parameters are stored in configuration files in &#8220;plain text way&#8221;</p>
<pre lang="groovy">
app.default.user = "tester"
</pre>
<p>or in &#8220;structured way&#8221;</p>
<pre lang="groovy">
app{
	default{
		user = "tester"
	}
}
</pre>
<p>In an application, one can access the parameters easily. Just import the correct class and ask it the correct question.</p>
<pre lang="groovy">
import org.codehaus.groovy.grails.commons.ConfigurationHolder

class TestController {
	def query = {
		render ConfigurationHolder.config.app.default.user
	}
}
</pre>
<p>The example above should render the string &#8220;tester&#8221;. Moreover, in the configuration files, one can easily define distinct config values for each of three different environments &#8211; production, development and test.</p>
<pre lang="groovy">
environments {
	production {
		grails.serverURL = "http://www.changeme.com"
	}
	development {
		grails.serverURL = "http://www.do-not-change.cz"
	}
	test {
		grails.serverURL = "http://www.just-for-test.de"
	}
}	
</pre>
<h2>External configuration</h2>
<p>The configuration mechanism of Grails is nice, but there is a small trouble. The configuration files are compiled and packed into the deployment package (WAR) during project build phase. However, one usually does not want to rebuild the whole application just to change say a database password. So, how to do it?
</p>
<p>The first step is to create an external configuration file. Let&#8217;s name it externalConfig.groovy. Its structure will be the same as the structure of the other configuration files &#8211; &#8220;flat text&#8221; or &#8220;structured&#8221;.</p>
<p>Now, how do you tell Grails to find and use it? Adding the following code to the beginning of your config.groovy will do the trick. It expects that there is an OS environment variable MY_GREAT_CONFIG that points to the configuration file.</p>
<pre lang="groovy">
if(System.getenv("MY_GREAT_CONFIG")) {
	println( "Including configuration file: " + System.getenv("MY_GREAT_CONFIG"));
	grails.config.locations << "file:" + System.getenv("MY_GREAT_CONFIG")
} else {
	println "No external configuration file defined."
}
</pre>
<h2>Spring configuration</h2>
<p>The grails-app/conf/spring/resources.groovy file gives the developer a convenient way to define beans. Distinguishing environments is slightly more complex than in other configuration files, but still elegant.</p>
<pre lang="groovy">
switch(GrailsUtil.environment) {
	case "production":
		myBean(package.BeanClass, 1, "prod")
		break
	case "test":
		myBean(package.BeanClass, 1, "test")
		break
	case "development":
		myBean(package.BeanClass, 1, "dev")
		break
</pre>
<p>Configuration parameters can be used here the same way as in the controller example above.</p>
<pre lang="groovy">
myBean(package.BeanClass, 1, ConfigurationHolder.config.app.default.user)
</pre>
<h2>Adding more environments</h2>
<p>It might seem that the development, test and production environments are just enough. Yes, that is true for most basic scenarios. However, if you develop for a large company with sophisticated deployment procedures, there are typically several production-level application server environments (one for user acceptance testing, one for system patch analysis and performance testing, one for production etc.), all of them corresponding to the Grails "production" environment.</p>
<p>How to address this scenario? Easily. Just introduce another environment into your configuration</p>
<pre lang="groovy">
environments {
	production {
		grails.serverURL = "http://www.changeme.com"
	}
	development {
		grails.serverURL = "http://www.do-not-change.cz"
	}
	test {
		grails.serverURL = "http://www.just-for-test.cz"
	}
	uat {
		grails.serverURL = "http://www.uat-testing-environment.cz"
	}
}	
</pre>
<p>and run the application or create a war file with an extra parameter</p>
<pre lang="groovy">
	grails -Dgrails.env=uat war
	or
	grails -Dgrails.env=uat run-app
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2009/04/22/playing-with-grails-application-configuration/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Configuration and usage of Gldapo in a Grails project</title>
		<link>https://blog.zmok.net/articles/2009/02/10/configuration-and-usage-of-gldapo-in-a-grails-project</link>
					<comments>https://blog.zmok.net/articles/2009/02/10/configuration-and-usage-of-gldapo-in-a-grails-project#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Mon, 09 Feb 2009 22:22:20 +0000</pubDate>
				<category><![CDATA[Gldapo]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[LDAP]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2009/02/10/configuration-and-usage-of-gldapo-in-a-grails-project</guid>

					<description><![CDATA[Configuration and usage of Gldapo in a Grails project Gldapo is a groovy library for object oriented LDAP access. &#8220;The Gldapo is to LDAP what GORM is to SQL&#8221;. Gldapo is packaged in Grails LDAP plugin, its installation is easy. In the root of your Grails project run command: grails install-plugin ldap Configuration The Gldapo&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2009/02/10/configuration-and-usage-of-gldapo-in-a-grails-project">Continue reading <span class="screen-reader-text">Configuration and usage of Gldapo in a Grails project</span></a>]]></description>
										<content:encoded><![CDATA[<h1>Configuration and usage of Gldapo in a Grails project</h1>
<p> <a href='http://gldapo.codehaus.org/'>Gldapo</a> is a groovy library for object oriented LDAP access. &#8220;The Gldapo is to LDAP what GORM is to SQL&#8221;.</p>
<p>Gldapo is packaged in Grails LDAP plugin, its installation is easy. In the root of your Grails project run command:</p>
<pre lang="text">grails install-plugin ldap</pre>
<h2>Configuration</h2>
<p>The Gldapo is configured in the Config.groovy file. Here follows an example.</p>
<pre lang="java">
ldap {
    directories {
        user { 
            url = "ldap://ldap.zmok.net"
            base = "OU=Users,DC=zmok,DC=net"
            userDn = "CN=usernameToLogToLdap,OU=Users,DC=zmok,DC=net"
            password = "passwordToLogToLdap" 
            searchControls { 
                countLimit = 40 
                timeLimit = 600 
                searchScope = "subtree" 
            }
        }
        group { 
            url = "ldap://ldap.zmok.net"
            base = "OU=Groups,DC=zmok,DC=net"
            userDn = "CN=usernameToLogToLdap,OU=Users,DC=zmok,DC=net"
            password = "passwordToLogToLdap"
            searchControls { 
                countLimit = 40 
                timeLimit = 600 
                searchScope = "subtree" 
            }
        }
    }

    schemas = [ 
        net.zmok.ldap.User,
        net.zmok.ldap.Group
    ]

}
</pre>
<p>The configuration is self-explaining, except of the schemas part. This is where the magic starts. The classes are object representation of the LDAP entities. So, let&#8217;s look how the classes are defined.</p>
<pre lang="java">
package net.zmok.ldap
import gldapo.schema.annotation.GldapoNamingAttribute

class User{
	@GldapoNamingAttribute
	String cn
	String title
	String displayName
	Set memberOf
}
</pre>
<pre lang="java">
package net.zmok.ldap
import gldapo.schema.annotation.GldapoNamingAttribute

class Group{
	@GldapoNamingAttribute
	String cn
	Set members
	@GldapoSynonymFor("mgr")
	String manager
}
</pre>
<p>Here, @GldapoNamingAttribute is mandatory and defines the key of the entity. The @GldapoSynonymFor redefines the LDAP names to human-readable format. In our case mgr will be translated to manager.</p>
<h2>Manipulation</h2>
<p>Usually, one needs to find a few records in an LDAP directory and do something with them. Lets say we need to find members of groups named like &#8220;Groovy*&#8221; (means GroovyProgrammers, GroovyFans, GroovyHaters) and their managers.<br />
	The Gldapo offers findAll method similar to GORM. So, here is the code to list them:</p>
<pre lang="java">
Group.findAll( directory: "group", filter: "(cn=Groovy*)" ).each{ group ->
	def groupName = group.cn
	group.members.each{ member ->
		def user = User.find( directory:"user", filter:"(cn=${member})")
		println "User ${user.displayName} managed by ${group.manager} is member of ${groupName}."
	}
}
</pre>
<p>Pretty easy, isn&#8217;t it? The User and Group classes are similar to GORM classes, so one can create, update, move, replace, delete&#8230; and much more. For details see <a href='http://gldapo.codehaus.org/schemaclasses/entries.html'>http://http://gldapo.codehaus.org/schemaclasses/entries.html</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2009/02/10/configuration-and-usage-of-gldapo-in-a-grails-project/feed</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
			</item>
		<item>
		<title>Grails RichUI &#8211; Incorrect international characters of the month names</title>
		<link>https://blog.zmok.net/articles/2009/01/16/grails-richui-incorrect-international-characters-of-the-month-names</link>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Thu, 15 Jan 2009 22:58:22 +0000</pubDate>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[RichUI]]></category>
		<category><![CDATA[workaround]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2009/01/16/grails-richui-incorrect-international-characters-of-the-month-names</guid>

					<description><![CDATA[I am working on a small project and I decided to use RichUI plugin do display a timeline. The plugin is just great and working like a charm. If you want to try it, this tutorial is a very good one. The english version works perfectly, but I have found a small bug in the&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2009/01/16/grails-richui-incorrect-international-characters-of-the-month-names">Continue reading <span class="screen-reader-text">Grails RichUI &#8211; Incorrect international characters of the month names</span></a>]]></description>
										<content:encoded><![CDATA[<p>I am working on a small project and I decided to use RichUI plugin do display a timeline.<br />
The plugin is just great and working like a charm. If you want to try it, <a href="http://docs.codehaus.org/display/GRAILS/RichUI+Plugin#RichUIPlugin-Timeline"> this tutorial</a> is a very good one.</p>
<p>The english version works perfectly, but I have found a small bug in the czech localization. The czech characters were displayed incorrectly.<br />
	 The whole page, including data of the timeline, was using utf-8 encoding (it was specified in the heading of the page), but the names of the months were in cp1250.</p>
<p>The problem lays in the source code of the RichUI plugin (I guess). A file with the czech names of the months was saved as cp1250 file, not as a utf-8 file.<br />
	So, the solution is simple. Change character set of the localization file</p>
<p>	<code>plugins/richui-0.4/web-app/js/timeline/scripts/l10n/cs/labellers.js</code></p>
<p>to utf-8 and save it.</p>
<p>Do not forget to delete </p>
<p>
		<code>web-app/plugins/richui-0.4</code></p>
<p>Update: The bug has been fixed in version 0.6. See <a href="https://fisheye.codehaus.org/browse/GRAILSPLUGINS-777">Jira</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Web services in Grails</title>
		<link>https://blog.zmok.net/articles/2008/11/04/web-services-in-grails</link>
					<comments>https://blog.zmok.net/articles/2008/11/04/web-services-in-grails#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Tue, 04 Nov 2008 19:40:30 +0000</pubDate>
				<category><![CDATA[web services]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[groovyWS]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2008/11/04/web-services-in-grails</guid>

					<description><![CDATA[This article summarizes my experience with web services in Grails (and also Groovy). It will focus the on client side &#8211; consuming web services. If you are looking for server size &#8211; providing services, you can use plugins like Metro or XFire. Options Once you want to create a web service client in pure groovy,&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2008/11/04/web-services-in-grails">Continue reading <span class="screen-reader-text">Web services in Grails</span></a>]]></description>
										<content:encoded><![CDATA[<p>This article summarizes my experience with web services in Grails (and also Groovy). It will focus the on client side &#8211;<br />
	consuming web services. If you are looking for server size &#8211; providing services, you can use <a href="http://grails.org/Plugins">plugins</a> like Metro or XFire. </p>
<h2>Options</h2>
<p>Once you want to create a web service client in pure groovy, you do not have much options. I have found just two libraries: <a href="http://groovy.codehaus.org/Groovy+SOAP">Groovy SOAP</a> and <a href="http://groovy.codehaus.org/GroovyWS">Groovy WS</a>.
</p>
<p>The first one is a deprecated module, so one have to use the Groovy WS.</p>
<h2>Sisyphean challenge</h2>
<h3>Libraries</h3>
<p>Making it running is a hard job. There are handy examples on the home page of the <a href="http://groovy.codehaus.org/GroovyWS">Groovy WS</a>, but none of the examples was working. I spent significant amount of time to find out what is the problem. I was receiving this strange error message: </p>
<pre lang="java">
	Oct 26, 2008 9:48:19 PM org.apache.cxf.bus.spring.SpringBusFactory createBus
WARNING: Failed to create application context.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:881)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)

	
	blah blah blah
</pre>
<p>After investigation I did find that the problem is with libraries. The groovy WS library does not like xerces and xml-apis libraries.</p>
<h3>SSL</h3>
<p>The second difficulty was SSL. I do not remember details. It was somehow unable to download WSDL over SSL. It was necessary to download it and store into file system. </p>
<h3>Compatibility</h3>
<p>GroovyWS uses the Apache CXF libraries and they do not support RPC/Encoded web services.</p>
<pre lang="java">
java.lang.RuntimeException: Error compiling schema from WSDL at {https://my.url?wsdl}: undefined simple or complex type 'soapenc:Array' 
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory$InnerErrorListener.error(DynamicClientFactory.java:418)
</pre>
<h2>Conclusion</h2>
<p>I did not find the groovyWS to be a matured library. It is possible to use it for consuming web services, but only for the simplest ones. As soon as there is SSL, authentication&#8230; one have to use a &#8220;bigger hammer&#8221;. In my case, the hammer was Netbeans, that generated all the necessary classes.</p>
<p>Last, but not least. At the beginning I was not really sure what is the problem. I was suspecting the web services not to work correctly. So, I did use the <a href="http://www.soapui.org/">soapUI</a> testing tool to check that the web services are alive.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2008/11/04/web-services-in-grails/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>String similarity detection</title>
		<link>https://blog.zmok.net/articles/2008/09/15/string-similarity-detection</link>
					<comments>https://blog.zmok.net/articles/2008/09/15/string-similarity-detection#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Mon, 15 Sep 2008 13:01:22 +0000</pubDate>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Similarity detection]]></category>
		<category><![CDATA[String algorithm]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2008/09/15/string-similarity-detection</guid>

					<description><![CDATA[I was looking for a simple string similarity detection algorithm and I did find the one on CatalySoft. Since I like it and I found it useful, I did create a groovy equivalent of it. Here is the code: public class LetterPairSimilarity { /** @return an array of adjacent letter pairs contained in the input&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2008/09/15/string-similarity-detection">Continue reading <span class="screen-reader-text">String similarity detection</span></a>]]></description>
										<content:encoded><![CDATA[<p>I was looking for a simple string similarity detection algorithm and I did find the one on  <a href="http://www.catalysoft.com/articles/StrikeAMatch.html">CatalySoft</a>. Since I like it and I found it useful, I did create a groovy equivalent of it.
</p>
<p>
Here is the code:
</p>
<pre lang="groovy">
public class LetterPairSimilarity {

  /** @return an array of adjacent letter pairs contained in the input string */
  private static def letterPairs(String str) {
    (0..str.size()-2).collect{str[it,it+1]} 
  }

  /** @return an ArrayList of 2-character Strings. */
  private static def wordLetterPairs(String str) {
    (str.split("\\s").collect{it} - [""]).collect{ letterPairs(it) }.flatten()
  }

  /** @return lexical similarity value in the range [0,1] */
  public static double compareStrings(String str1, String str2) {
    if (!str1 || !str2 || str1=="" || str2=="") {return 0.0}
    def p1=wordLetterPairs(str1.toUpperCase())
    def p2=wordLetterPairs(str2.toUpperCase())

    2*p1.intersect(p2).size() / (p1+p2).size
  }
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2008/09/15/string-similarity-detection/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Modalbox in Grails</title>
		<link>https://blog.zmok.net/articles/2008/08/12/modalbox-in-grails</link>
					<comments>https://blog.zmok.net/articles/2008/08/12/modalbox-in-grails#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Tue, 12 Aug 2008 21:20:19 +0000</pubDate>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Modalbox]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2008/08/12/modalbox-in-grails</guid>

					<description><![CDATA[There is a nice and handy javascript library for creating kind of a modal &#8220;window&#8221;, similar to the famous lightbox. Here are few lines of code to make it running in a Grails application Installation First of all, you have to download the library. The easiest way is to install a plugin modalbox grails install-plugin&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2008/08/12/modalbox-in-grails">Continue reading <span class="screen-reader-text">Modalbox in Grails</span></a>]]></description>
										<content:encoded><![CDATA[<p>There is a nice and handy <a href='http://www.wildbit.com/labs/modalbox/'>javascript library</a> for creating kind of a modal &#8220;window&#8221;, similar to the famous lightbox. Here are few lines of code to make it running in a Grails application </p>
<h2>Installation</h2>
<p>First of all, you have to download the library. The easiest way is to install a plugin modalbox </p>
<pre lang="text">
grails install-plugin modalbox
</pre>
<p>There was a slight problem in version 0.2. So, check your plugins/modalbox-0.2/grails-app/taglib/ModalboxTagLib.groovy. The version was not correct and the script tags were not correctly ended. Here is my tag library.</p>
<pre lang="groovy">
class ModalboxTagLib {

    static namespace = "modalbox"

    def createLink = { attrs,body ->
        // By default trigger onclick, but allow onmouseover etc
        def event = attrs.event ? attrs.event : 'onclick';

        // linkname only supported for backwards-compatibility. Default it to empty-string
        def linkname = attrs.linkname ? attrs.linkname : ""

        out << """
            <a href='${g.createLink(attrs)}' title='${attrs['title']}' ${event}='Modalbox.show(this.href, {title: this.title, width: ${attrs['width']}}); return false;'>${linkname}${body.call()}</a>
        """
    }
    
    def modalIncludes = {
        def jsFolder    = createLinkTo(dir:'plugins',file:'modalbox-0.2/js/modalbox')
        def cssFolder   = createLinkTo(dir:'plugins',file:'modalbox-0.2/css')
        
        out << """
            <script type='text/javascript' src='${jsFolder}/prototype.js' ></script>
    		<script type='text/javascript' src='${jsFolder}/scriptaculous.js?load=effects'></script>
    		<script type='text/javascript' src='${jsFolder}/modalbox.js' ></script>
    		<link rel='stylesheet' href='${cssFolder}/modalbox.css' />
        """
    }
}
</pre>
<h2>&#8220;Parent&#8221; view</h2>
<p>In the view that will call the Modalbox, use tag modalInclude like this one. </p>
<pre lang="html">
<modalbox:createLink controller="book" action="showDetails" params="[bookId:book.id]" title="Book details" width="500">book</modalbox:createLink>
</pre>
<p>Once clicked, it calls book/showDetails</p>
<h2>&#8220;Modalbox&#8221; view</h2>
<p>The view of book/showDetails is quite simple. You can create any static page and it will be displayed. If you want something more &#8220;spicy&#8221;, use AJAX.</p>
<pre lang="html">
Book details

<g:formRemote name="myForm" url="[controller:'book',action:'findSimilar']" update="[success:'similar']" onComplete="Modalbox.resizeToContent()">
	<input type="hidden" name="bookId" value="${book.id}" />
	<input id='search' name='search' />
	<input type="submit" value="Find similar" />
</g:formRemote >

<div id="similar">
</div>

<a href="#" title="Close window" onclick="Modalbox.hide(); return false;">Close</a>
</pre>
<p>Notice the resizeToContent() method. It assures, that the content that will come via AJAX will fit. Last, but not least; for comfortable close, there is the last line.</p>
<p>Enjoy it.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2008/08/12/modalbox-in-grails/feed</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>Grails: internationalization in the service</title>
		<link>https://blog.zmok.net/articles/2008/08/07/grails-internationalization-in-the-service</link>
					<comments>https://blog.zmok.net/articles/2008/08/07/grails-internationalization-in-the-service#comments</comments>
		
		<dc:creator><![CDATA[Roman Mackovčák]]></dc:creator>
		<pubDate>Thu, 07 Aug 2008 20:00:37 +0000</pubDate>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<guid isPermaLink="false">http://blog.zmok.net/articles/2008/08/07/grails-internationalization-in-the-service</guid>

					<description><![CDATA[Today I spent some time by creation of localized messages in a service. Here is a small tutorial. 1. Create your service grails create-service Local 2. Add a messageSource variable to your new service class LocalService { def messageSource } 3. Use it in a service method // Initialize parameters Object[] testArgs = {} def&#8230; <a class="more-link" href="https://blog.zmok.net/articles/2008/08/07/grails-internationalization-in-the-service">Continue reading <span class="screen-reader-text">Grails: internationalization in the service</span></a>]]></description>
										<content:encoded><![CDATA[<p>Today I spent some time by creation of localized messages in a service. Here is a small tutorial.</p>
<p>1. Create your service</p>
<pre lang="shell">
grails create-service Local
</pre>
<p>2. Add a messageSource variable to your new service</p>
<pre lang="groovy">
class LocalService {
  def messageSource
}
</pre>
<p>3. Use it in a service method</p>
<pre lang="groovy">
// Initialize parameters
Object[] testArgs = {}
def msg = messageSource.resolveCode("message.code.to.translate", new java.util.Locale("EN")).format(testArgs)
</pre>
<p>4. Finally edit the grails-app/i18n/messages.properties</p>
<pre lang="text">
message.code.to.translate=It works!!!
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.zmok.net/articles/2008/08/07/grails-internationalization-in-the-service/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
	</channel>
</rss>
