<?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>redstream &#187; Mule</title>
	<atom:link href="http://www.redstream.nl/category/technical/mule-technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.redstream.nl</link>
	<description>Pragmatic Integrators</description>
	<lastBuildDate>Fri, 27 Jan 2012 19:31:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Parameters in Your Mule Configuration Files</title>
		<link>http://www.redstream.nl/2012/01/27/using-parameters-in-your-mule-configuration-files/</link>
		<comments>http://www.redstream.nl/2012/01/27/using-parameters-in-your-mule-configuration-files/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 19:31:59 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Mule3]]></category>
		<category><![CDATA[XML/ XSD/ XSLT]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2915</guid>
		<description><![CDATA[Although I am not always happy with the online documentation of the Mule ESB I found this article quite good. I have set up our configuration of Mule ESB implementation on several projects this way and it has proved to &#8230; <a href="http://www.redstream.nl/2012/01/27/using-parameters-in-your-mule-configuration-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2012%2F01%2F27%2Fusing-parameters-in-your-mule-configuration-files%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2012%2F01%2F27%2Fusing-parameters-in-your-mule-configuration-files%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Although I am not always happy with the online documentation of the <a href="http://www.mulesoft.org/">Mule ESB</a> I found <a href="http://www.mulesoft.org/documentation/display/MULE3USER/Using+Parameters+in+Your+Configuration+Files">this article</a> quite good. I have set up our configuration of Mule ESB implementation on several projects this way and it has proved to be working nicely. Although last time I got into the following issue. To use a datasource in my Mule3 project I had configured it like this in my Mule config file:</p>

<div class="wp_codebox"><table><tr id="p29153"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2915code3"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jdbc:oracle-data-source</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jdbcDataSource&quot;</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">user</span>=<span style="color: #ff0000;">&quot;${db.username}&quot;</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${db.password}&quot;</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">host</span>=<span style="color: #ff0000;">&quot;${db.host}&quot;</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;${db.port}&quot;</span> </span>
<span style="color: #009900;">          <span style="color: #000066;">sid</span>=<span style="color: #ff0000;">&quot;{db.sid}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>However, when I deployed the application on my Mule instance I got the following XML parse exception:</p>
<blockquote><p>
org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: &#8216;${db.port}&#8217; is not a valid value for &#8216;integer&#8217;.
</p></blockquote>
<p>This is caused by the fact that the XML is validated against its XSD before the parameters are resolved. Although I found threads in several forums that described a solution for this issue I chose the following (pragmatic) solution. I decided to configure the datasource like this:</p>

<div class="wp_codebox"><table><tr id="p29154"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2915code4"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jdbc:oracle-data-source</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jdbcDataSource&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">user</span>=<span style="color: #ff0000;">&quot;${db.username}&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;${db.password}&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;jdbc:oracle:thin:@//${db.host}:${db.port}/${db.sid}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>This way the XML validates fine against its XSD and during runtime the parameters are resolved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2012/01/27/using-parameters-in-your-mule-configuration-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Mule3 as WS-Security proxy</title>
		<link>http://www.redstream.nl/2012/01/22/use-mule3-as-ws-security-proxy/</link>
		<comments>http://www.redstream.nl/2012/01/22/use-mule3-as-ws-security-proxy/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 13:48:05 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Mule3]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[CXF]]></category>
		<category><![CDATA[WSS4J]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2902</guid>
		<description><![CDATA[As I wrote before it is quite easy to set up a web service proxy with Mule3. in this example I take it a step further and I describe how you can add WS-Security implementation to it. Although in the &#8230; <a href="http://www.redstream.nl/2012/01/22/use-mule3-as-ws-security-proxy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2012%2F01%2F22%2Fuse-mule3-as-ws-security-proxy%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2012%2F01%2F22%2Fuse-mule3-as-ws-security-proxy%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>As I wrote <a href="http://www.redstream.nl/2011/09/24/set-up-web-service-proxy-with-mule3/" title="Set up Web Service Proxy with Mule3">before</a> it is quite easy to set up a web service proxy with Mule3. in this example I take it a step further and I describe how you can add WS-Security implementation to it. Although in the end this also is quite easy you have to make the correct configuration choices to get everything to work.</p>
<p>The first thing I had to do in my Mule config was to drop the pattern prefix. This took me a while to discover because I think this isn&#8217;t very clear in the documentation. Anyway, after that change it is fairly straight forward.<br />
<span id="more-2902"></span><br />
Here is the Mule config I ended up with:</p>

<div class="wp_codebox"><table><tr id="p29027"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
</pre></td><td class="code" id="p2902code7"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mule</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/core&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:cxf</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/cxf&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:spring</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:http</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/http&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd</span>
<span style="color: #009900;">        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flow</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;create-client&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;http:inbound-endpoint</span> <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;http://localhost:8080/create-client&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cxf:proxy-service</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/http:inbound-endpoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;http:outbound-endpoint</span> <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;http://localhost:8081/create-client&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cxf:proxy-client<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cxf:outInterceptors<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:constructor-arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;action&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Timestamp Signature&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;user&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${signature.user}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;signaturePropFile&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;ws-security.properties&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;passwordCallbackClass&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;nl.redstream.adapter.MyKeystorePasswordCallback&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:constructor-arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.cxf.interceptor.LoggingOutInterceptor&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cxf:outInterceptors<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cxf:proxy-client<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/http:outbound-endpoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flow</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;get-client-status&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;http:inbound-endpoint</span> <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;http://localhost:8081/get-status&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cxf:proxy-service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cxf:inInterceptors<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.cxf.interceptor.LoggingInInterceptor&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:constructor-arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;action&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Signature&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;signaturePropFile&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;ws-security.properties&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:constructor-arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cxf:inInterceptors<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cxf:proxy-service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/http:inbound-endpoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;http:outbound-endpoint</span> <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;http://localhost:8080/get-status&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cxf:proxy-client</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/http:outbound-endpoint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>As you can see I have added two flows. The first flow is &#8216;create-client&#8217;. I receive the incoming call from my own &#8216;inside&#8217;-application and add a signature and timestamp to it before I forward it to the &#8216;outside&#8217; service.<br />
The second flow works the other way around: I receive a signed message from the &#8216;outside&#8217; client app and I need to validate this before I pas the message to my &#8216;inside&#8217; application. To create the signature I need the password for to make use of my private key in the keystore. To supply this password I simply implemented the PasswordCallbackHandler that returns the corresponding password by looking it up in a property file. For more info about configuring the WS-security with CFX see <a href="https://cwiki.apache.org/CXF20DOC/ws-security.html" title="CXF ws-security" target="_blank">here</a> and also I found <a href="http://ws.apache.org/wss4j/config.html" title="Apache WSS4J" target="_blank">this</a> entry about Apache WSS4J quite handy.<br />
The security property file that is referred to in my Mule config file contains the following:</p>

<div class="wp_codebox"><table><tr id="p29028"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2902code8"><pre class="text" style="font-family:monospace;">org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=JKS
org.apache.ws.security.crypto.merlin.file=/KeyStores/redstreamKeystore.jks
org.apache.ws.security.crypto.merlin.keystore.password=myPassword</pre></td></tr></table></div>

<p>For both flows I added the logging interceptor which is quite handy during testing and developing to see what is received and sent out. In the next post I will show how to generate the keystores and configure SoapUI to test the proxy manually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2012/01/22/use-mule3-as-ws-security-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set up Web Service Proxy with Mule3</title>
		<link>http://www.redstream.nl/2011/09/24/set-up-web-service-proxy-with-mule3/</link>
		<comments>http://www.redstream.nl/2011/09/24/set-up-web-service-proxy-with-mule3/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 14:06:48 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mule3]]></category>
		<category><![CDATA[SoapUI]]></category>
		<category><![CDATA[Web Service]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2826</guid>
		<description><![CDATA[In this post I show you how I setup a little test to see if and how easy I could manage to route the traffic to and from a web service through Mule ESB. The business case for this is &#8230; <a href="http://www.redstream.nl/2011/09/24/set-up-web-service-proxy-with-mule3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F09%2F24%2Fset-up-web-service-proxy-with-mule3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F09%2F24%2Fset-up-web-service-proxy-with-mule3%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this post I show you how I setup a little test to see if and how easy I could manage to route the traffic to and from a web service through <a href="http://www.mulesoft.org/">Mule ESB</a>. The business case for this is an issue that one of our customers ran into when using web services. In a program hundreds of calls are done in a relative short period. Most of the time this isn&#8217;t a problem but sometimes vague issues occur. To get a better insight in this issue I want to put Mule in the middle so I can log the request and response and hopefully get a better idea about what is sent across the line. This is called the Web Service Proxy pattern and is commonly used to validate and audit the web service calls. For more background info about this pattern see <a href="http://www.mulesoft.org/documentation/display/MULE3USER/Web+Service+Proxy+Pattern">this article</a>.<br />
<span id="more-2826"></span><br />
To get started I downloaded the <a href="http://www.mulesoft.org/download-mule-esb-community-edition">Mule Standalone edition</a> here and installed it. That isn&#8217;t very hard, just untar the thing and set the MULE_HOME property. Go to the bin directory and give &#8216;./mule&#8217; and off you go (except for a warning when running on MacOS 64-bit, but it doesn&#8217;t seem to harm so far…):<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/09/warning.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/09/warning-300x222.jpg" alt="" title="warning" width="300" height="222" class="aligncenter size-medium wp-image-2829" /></a></p>
<p>To create a test web service I setup a MockService in SoapUI. Like this:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-15.45.06.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-15.45.06-300x193.jpg" alt="" title="SoapUI MockService" width="300" height="193" class="aligncenter size-medium wp-image-2846" /></a><br />
All you need is a WSDL available. I just picked one from a previous project for testing purposes. With this MockService started you can fire your SOAP requests and will receive a (predefined) response from the MockService:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-15.47.54.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-15.47.54-300x137.jpg" alt="" title="SoapUi Response" width="300" height="137" class="aligncenter size-medium wp-image-2847" /></a></p>
<p>Next step is create a new Mule project (I still favor <a href="http://maven.apache.org/">Maven</a> above the <a href="http://www.mulesoft.org/documentation/display/MULESTUDIO/Home">Mule Studio</a>):</p>
<ul>
<li>create new Maven project with</li>
<p><code>mvn mule-project-archetype:create -DartifactId=WSProxy -DmuleVersion=3.1.2</code></p>
<li>Set up the WS Proxy</li>
<p>To create WS Proxy I followed the description <a href="http://www.mulesoft.org/documentation/display/MULE3USER/Web+Service+Proxy+Pattern">here</a><br />
Note: to make use of the pre-defined &#8216;pattern&#8217; you must add the following dependency to the pom:</p>

<div class="wp_codebox"><table><tr id="p282611"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p2826code11"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.mule.patterns<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mule-patterns-all<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${mule.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>provided<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>My Mule config file looks like this:</p>

<div class="wp_codebox"><table><tr id="p282612"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p2826code12"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mule</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/core&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:pattern</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/pattern&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.1/mule-pattern.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    Proxies a Web Service
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;custom-transformer</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;my-transformer&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nl.redstream.proxy.wsproxy.MyTransformer&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;object-to-string-transformer</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ObjectToStringTransformer&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pattern:web-service-proxy</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;my-order-ws-proxy&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">inboundAddress</span>=<span style="color: #ff0000;">&quot;http://Pascal-Almas-MacBook-Pro.local:8090/my-order&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">responseTransformer-refs</span>=<span style="color: #ff0000;">&quot;ObjectToStringTransformer my-transformer&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">outboundAddress</span>=<span style="color: #ff0000;">&quot;http://Pascal-Almas-MacBook-Pro.local:8088/mockDataServiceSoapBinding&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<li>Fire up the proxy</li>
<p>To run the Mule application just make sure your Mule installation is running and in your project execute the command &#8216;mvn clean install&#8217;<br />
You should see a message in your Mule console like this:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-07-at-21.25.54.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-07-at-21.25.54-300x82.jpg" alt="" title="Mule console" width="300" height="82" class="aligncenter size-medium wp-image-2840" /></a>
</ul>
<p>Now we can put the proxy at work by redirecting the SoapUI request to the url: http://Pascal-Almas-MacBook-Pro.local:8090/my-order. It should the be forwarded to the original url and the translator I put in between should output the content to the Mule console:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-15.57.57.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-15.57.57-300x114.jpg" alt="" title="MuleLogging" width="300" height="114" class="aligncenter size-medium wp-image-2849" /></a> </p>
<p>However if you try this for the first time big chance you will run into <a href="http://www.mulesoft.org/jira/browse/MULE-5363">this</a> issue (at least I did). To get around this issue modify the soapUI settings like this:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-16.01.52.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/09/Screen-Shot-2011-09-24-at-16.01.52-300x219.jpg" alt="" title="soapui-prefs" width="300" height="219" class="aligncenter size-medium wp-image-2850" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/09/24/set-up-web-service-proxy-with-mule3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use Mule to sync WordPress sites</title>
		<link>http://www.redstream.nl/2011/07/11/use-mule-to-sync-wordpress-sites/</link>
		<comments>http://www.redstream.nl/2011/07/11/use-mule-to-sync-wordpress-sites/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 18:31:49 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Mule iON]]></category>
		<category><![CDATA[Mule3]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2780</guid>
		<description><![CDATA[I got triggered by my previous post to create a process with which I could keep two instances of WordPress in sync. I wanted to see if I could do this with Mule. I came up with the following solution: &#8230; <a href="http://www.redstream.nl/2011/07/11/use-mule-to-sync-wordpress-sites/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F07%2F11%2Fuse-mule-to-sync-wordpress-sites%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F07%2F11%2Fuse-mule-to-sync-wordpress-sites%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I got triggered by my <a href="http://www.redstream.nl/2011/06/30/redstream-goes-cloud/">previous</a> post to create a process with which I could keep two instances of <a href="http://wordpress.org/">WordPress</a> in sync. I wanted to see if I could do this with Mule. I came up with the following solution:</p>
<ul>
<li>Receive the RSS feed of a new post in Mule flow</li>
<li>Use the content of the RSS feed to post to the other wordpress instance by using XML-RPC</li>
<li>Have it running on <a href="www.mulesoft.com/mule-ion-ipaas-cloud-based-integration-demand ">Mule iON</a> so I don&#8217;t have to setup my own Muleserver</li>
</ul>
<p><span id="more-2780"></span><br />
So lets start a new Mule iON project. Since I am a big fan of <a href="http://netbeans.org/">Netbeans</a> I use <a href="http://www.mulesoft.org/documentation/display/ION/Build+your+First+Project+with+Maven+and+Command+Line">the Maven based approach</a> (I must admit I have tried to use <a href="http://www.mulesoft.org/documentation/display/MULESTUDIO/Getting+Started+with+Mule+Studio">MuleStudio</a> for this but it didn&#8217;t bring me the productivityboost I hoped for).<br />
I created the Mule project with:<br />
<code><br />
mvn org.mule.tools:mule-project-archetype:create -DartifactId=wordpress-copy-service -DgroupId=nl.redstream.mule-ion -Dinteractive=false -Dmodules=rss -DmuleVersion=3.1.1<br />
</code></p>
<p>The Mule config looks like:</p>

<div class="wp_codebox"><table><tr id="p278016"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code" id="p2780code16"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mule</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/core&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:http</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/http&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:rss</span>=<span style="color: #ff0000;">&quot;http://www.mulesoft.org/schema/mule/rss&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">xmlns:spring</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.1/mule-http.xsd</span>
<span style="color: #009900;">        http://www.mulesoft.org/schema/mule/rss http://www.mulesoft.org/schema/mule/rss/3.1/mule-rss.xsd</span>
<span style="color: #009900;">        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:bean</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;xmlRpcHelper&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nl.redstream.rss.XmlRpcHelper&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:constructor-arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://www.pragmatic-integrators.com/xmlrpc.php&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;java.lang.String&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:constructor-arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;UserName&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;java.lang.String&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:constructor-arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Password&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;java.lang.String&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:bean</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;entryReceiver&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nl.redstream.rss.EntryReceiver&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:constructor-arg</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;xmlRpcHelper&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flow</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;poll-and-post&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;poll</span> <span style="color: #000066;">frequency</span>=<span style="color: #ff0000;">&quot;36000000&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;http:outbound-endpoint</span> <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;http://www.redstream.nl/feed/&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/poll<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rss:feed-splitter</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring-object</span> <span style="color: #000066;">bean</span>=<span style="color: #ff0000;">&quot;entryReceiver&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>As you can see I poll the website &#8216;www.redstream.nl&#8217; once each 10 hours. The RSS feed I receive is split and sent to my custom made component &#8216;entryReceiver&#8217;. It would be nice to use a XML-RPC endpoint here but this isn&#8217;t created <a href="http://www.mulesoft.org/documentation/display/XMLRPC/Home">yet</a> (and actually I don&#8217;t feel like it neither).</p>
<p>The EntryReceiver looks like:</p>
<blockquote><p>Disclaimer: just wanted to see if it worked, I did not try to build a robust solution that had to work for every WordPress site, so you are warned!</p></blockquote>

<div class="wp_codebox"><table><tr id="p278017"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code" id="p2780code17"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">nl.redstream.rss</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.mule.api.annotations.param.Payload</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.sun.syndication.feed.synd.SyndEntry</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EntryReceiver <span style="color: #009900;">&#123;</span>
&nbsp;
    XmlRpcHelper xmlRpcHelper <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> EntryReceiver<span style="color: #009900;">&#40;</span>XmlRpcHelper helper<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        xmlRpcHelper <span style="color: #339933;">=</span> helper<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> readEntry<span style="color: #009900;">&#40;</span>@Payload SyndEntry entry<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Get the title</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> title <span style="color: #339933;">=</span> entry.<span style="color: #006633;">getTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Check if title exist in current blogs on the new blogsite</span>
       <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>xmlRpcHelper.<span style="color: #006633;">titleExists</span><span style="color: #009900;">&#40;</span>title<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            xmlRpcHelper.<span style="color: #006633;">post</span><span style="color: #009900;">&#40;</span>entry<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// Skip this post</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And the bean where the dirty work is done:</p>

<div class="wp_codebox"><table><tr id="p278018"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
</pre></td><td class="code" id="p2780code18"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">nl.redstream.rss</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.MalformedURLException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URL</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.xmlrpc.XmlRpcException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.xmlrpc.client.XmlRpcClient</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.xmlrpc.client.XmlRpcClientConfigImpl</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.sun.syndication.feed.synd.SyndContentImpl</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.sun.syndication.feed.synd.SyndEntry</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> XmlRpcHelper <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> url<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> userName<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> password<span style="color: #339933;">;</span>
    XmlRpcClient client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XmlRpcClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> XmlRpcHelper<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> url, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> u, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">url</span> <span style="color: #339933;">=</span> url<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">userName</span> <span style="color: #339933;">=</span> u<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">password</span> <span style="color: #339933;">=</span> p<span style="color: #339933;">;</span>
&nbsp;
        XmlRpcClientConfigImpl config <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XmlRpcClientConfigImpl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
            config.<span style="color: #006633;">setServerURL</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aurl+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">URL</span></a><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amalformedurlexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">MalformedURLException</span></a> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        client.<span style="color: #006633;">setConfig</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> titleExists<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> title<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> getRecentTitles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span>title<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> post<span style="color: #009900;">&#40;</span>SyndEntry entry<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        StringBuilder content <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;content&gt;&lt;title&gt;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>entry.<span style="color: #006633;">getTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;/title&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        List<span style="color: #339933;">&lt;</span>SyndContentImpl<span style="color: #339933;">&gt;</span> contents <span style="color: #339933;">=</span> entry.<span style="color: #006633;">getContents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>SyndContentImpl syndContent <span style="color: #339933;">:</span> contents<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            content.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>syndContent.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        content.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;/content&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
            client.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;blogger.newPost&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;bla&quot;</span>, <span style="color: #cc66cc;">1</span>,
                        userName, password, content.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>XmlRpcException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> getRecentTitles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> titles <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a> token <span style="color: #339933;">=</span> client.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;blogger.getRecentPosts&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;bla&quot;</span>, <span style="color: #cc66cc;">1</span>,
                        userName, password, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> token<span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> result.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                titles.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>getTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>HashMap<span style="color: #339933;">&lt;</span>String, Object<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>XmlRpcException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
            e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #666666; font-style: italic;">// return null;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> titles<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> getTitle<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Amap+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Map</span></a> response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> title <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> content <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#41;</span> response.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>content <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            title <span style="color: #339933;">=</span> content.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>content.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;title&gt;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">7</span>,
                    content.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;/title&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> title<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<blockquote><p>One thing that kept me busy for a while was that the first String in the Object array that is supplied with the XmlRpc call may contain anything as long as it contains something. An emptry String &#8220;&#8221; is ignored in the call and will lead to an invalid Username/Password message.
</p></blockquote>
<p>If all this is in place you can build the project with: &#8216;mvn clean install&#8217;. This will create a zip file in the target directory. This zip file can then be uploaded with your dashboard to your Mule iON instance:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/07/Screen-shot-2011-07-11-at-20.20.17.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/07/Screen-shot-2011-07-11-at-20.20.17-300x147.jpg" alt="" title="Screen shot 2011-07-11 at 20.20.17" width="300" height="147" class="aligncenter size-medium wp-image-2792" /></a></p>
<p>And that&#8217;s it! As you can see the two sites &#8216;www.redstream.nl&#8217; and &#8216;www.pragmatic-integrators.com&#8217; are know kept in sync (with a max. gap of 10 hrs). Of course the copied post is not an exact clone of the original (I am loosing info about the Author, Categories, etc. and images are referred to at the original location) but it shows that the main idea works!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/07/11/use-mule-to-sync-wordpress-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redstream goes Cloud</title>
		<link>http://www.redstream.nl/2011/06/30/redstream-goes-cloud/</link>
		<comments>http://www.redstream.nl/2011/06/30/redstream-goes-cloud/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 13:19:24 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[Mule iON]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[Cloud]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2755</guid>
		<description><![CDATA[Last week I migrated our site and blog to the Cloud. I got triggered by this article. That in the combination with the free account at Amazon&#8217;s EC2 was enough for me give it a try. Now, if you came &#8230; <a href="http://www.redstream.nl/2011/06/30/redstream-goes-cloud/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F06%2F30%2Fredstream-goes-cloud%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F06%2F30%2Fredstream-goes-cloud%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Last week I migrated our site and blog to the Cloud. I got triggered by <a href="http://www.agileweboperations.com/migrate-your-wordpress-blog-to-a-bitnami-ec2-instance">this</a> article. That in the combination with <a href="http://aws.amazon.com/free/">the free account</a> at Amazon&#8217;s EC2 was enough for me give it a try.<span id="more-2755"></span><br />
Now, if you came here via <a href="http://www.redstream.nl">&#8216;www.redstream.nl&#8217;</a> you are looking at the version hosted at our own server. But if you got here via &#8216;<a href="http://www.pragmatic-integrators.com">www.pragmatic-integrators.com</a>&#8216; you are looking at the version hosted in the Cloud.<br />
After I migrated the site I realized how easy it is to use a server in the cloud and made me wonder why you should ever want your own physical &#8216;web&#8217;server. For the time being I will keep both instances alive so I can compare both solutions.<br />
Now I have to find a way to keep these two instances in sync… That would be a nice use case using <a href="http://www.mulesoft.com/mule-ion-ipaas-cloud-based-integration-demand">Mule iON</a> to stay in the Clouds&#8230; I&#8217;ll post the solution here as soon as I have worked it out ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/06/30/redstream-goes-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mule in the Cloud: First impression</title>
		<link>http://www.redstream.nl/2011/06/17/mule-in-the-cloud-first-impression/</link>
		<comments>http://www.redstream.nl/2011/06/17/mule-in-the-cloud-first-impression/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 07:24:34 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Mule iON]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2746</guid>
		<description><![CDATA[Like I posted before Mulesoft has released a new platform: iPAAS. I just went through the starters guide and I am pretty impressed. Of course the use case in the tutorial is very simple but the whole idea of just &#8230; <a href="http://www.redstream.nl/2011/06/17/mule-in-the-cloud-first-impression/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F06%2F17%2Fmule-in-the-cloud-first-impression%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F06%2F17%2Fmule-in-the-cloud-first-impression%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Like I posted <a href="http://www.redstream.nl/2011/06/16/new-products-from-mulesoft/">before</a> Mulesoft has released a new platform: <a href="http://www.mulesoft.com/ipaas-integration-platform-as-a-service">iPAAS</a>. I just went through <a href="http://www.mulesoft.org/documentation/display/ION/Build+Your+First+Project+with+Mule+Studio">the starters guide</a> and I am pretty impressed. Of course the use case in the tutorial is very simple but the whole idea of just putting your Mule config into the cloud and it runs sounds good. And I have seen it working (you can check for yourself by submitting text to <a href="http://redstream.muleion.com/services/EchoUMO/echo/text/put%20your%20text%20here">this url</a>. <span id="more-2746"></span><br />
Here is a snapshot of the dashboard you get with you <a href="http://www.mulesoft.org/documentation/display/ION/Getting+Started">Mule iON</a> account:<br />
<a href="http://www.redstream.nl/wp-content/uploads/2011/06/Screen-shot-2011-06-16-at-10.59.44.jpg"><img src="http://www.redstream.nl/wp-content/uploads/2011/06/Screen-shot-2011-06-16-at-10.59.44-300x219.jpg" alt="" title="Screen shot 2011-06-16 at 10.59.44" width="300" height="219" class="aligncenter size-medium wp-image-2747" /></a><br />
Although it looks pretty nice at first sight it does raise questions and some topics for further investigation: what about security and in what use cases will this be the best solution? Mulesoft already has answers to those questions (<a href="http://www.mulesoft.org/documentation/display/ION/Secure+Data+Gateway">security</a> and <a href="http://www.mulesoft.org/documentation/display/ION/Use+Cases">use cases</a>) but I am going to find out myself and let you know my opinion. Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/06/17/mule-in-the-cloud-first-impression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New products from Mulesoft</title>
		<link>http://www.redstream.nl/2011/06/16/new-products-from-mulesoft/</link>
		<comments>http://www.redstream.nl/2011/06/16/new-products-from-mulesoft/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 06:56:33 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Mule3]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Mule]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2738</guid>
		<description><![CDATA[Mulesoft recently released some new products, totally different from each other but both very welcome. The first one is MuleStudio. Mule Studio is an Eclipse-based developer tool, that allows to graphically create and test Mule ESB Flows. It is currently &#8230; <a href="http://www.redstream.nl/2011/06/16/new-products-from-mulesoft/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F06%2F16%2Fnew-products-from-mulesoft%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F06%2F16%2Fnew-products-from-mulesoft%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.mulesoft.com/">Mulesoft</a> recently released some new products, totally different from each other but both very welcome.<br />
The first one is <a href="http://www.mulesoft.org/documentation/display/MULESTUDIO/Home">MuleStudio</a>. Mule Studio is an Eclipse-based developer tool, that allows to graphically create and test Mule ESB Flows. It is currently in beta but I think it might be a good reason to go back to Eclipse. Last few years I have been using Netbeans for my Mule/Java development because I liked the combination between Netbeans and Maven better.</p>
<p>The other &#8216;product&#8217; that is released is <a href="http://www.mulesoft.com/how-does-it-work">Mule iON</a>. I think a graphical development tool is nice to have but this iON thing is something that can really become big. It makes you use the cloud as the platform for your integration software. They call it the iPAAS (Integration Platform as a Service).</p>
<p>The coming days I will have a look at both and posts my findings here so stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/06/16/new-products-from-mulesoft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Citrus testcase example: CSV File Inbound -&gt; Xml Http Outbound</title>
		<link>http://www.redstream.nl/2011/04/30/citrus-testcase-example-csv-file-inbound-xml-http-outbound/</link>
		<comments>http://www.redstream.nl/2011/04/30/citrus-testcase-example-csv-file-inbound-xml-http-outbound/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 06:51:01 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Citrus]]></category>
		<category><![CDATA[Mule]]></category>
		<category><![CDATA[Spring Framework]]></category>
		<category><![CDATA[Spring Integration]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2679</guid>
		<description><![CDATA[As promised I&#8217;m going to show a test case for which I have used Citrus to implement it. The case is like this: In a predefined folder on a machine a character-separated file is placed. This file is picked up &#8230; <a href="http://www.redstream.nl/2011/04/30/citrus-testcase-example-csv-file-inbound-xml-http-outbound/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F04%2F30%2Fcitrus-testcase-example-csv-file-inbound-xml-http-outbound%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F04%2F30%2Fcitrus-testcase-example-csv-file-inbound-xml-http-outbound%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>As <a href="http://www.redstream.nl/2011/04/15/setup-citrus-for-testing-mule-esb/">promised</a> I&#8217;m going to show a test case for which I have used <a href="http://www.citrusframework.org/">Citrus</a> to implement it. The case is like this:<br />
In a predefined folder on a machine a character-separated file is placed. This file is picked up by our <a href="http://www.mulesoft.org/what-mule-esb">Mule ESB</a> application. The content is transformed to XML and this XML document is posted to another application over HTTP. This application responds with XML document telling the document was processed correctly.<br />
To test this interface with Citrus we have to perform the following steps:</p>
<ol>
<li>Copy the input test-file to the predefined folder so it is picked up by the test instance of our Mule ESB</li>
<p>Our Mule ESB will poll a directory each second to check if there is placed a new file to process. Our test case starts by having Citrus putting a test file in the directory .</p>
<li>Have Citrus listen on a predefined HTTP port to receive the XML message over HTTP</li>
<p>Inside our Mule ESB the file is transformed to XML message and posted on a HTTP port to be processed by the &#8216;ORDER&#8217; system. We have configured Citrus to listen on this specific HTTP port to pick up the XML message.</p>
<li>Reply to the received message with a predefined XML message</li>
<p>This steps mimics the &#8216;ORDER&#8217; system as it would normally process the incoming XML message and respond with another XML message. In this case Citrus will send back a predefined XML message as response.
</ol>
<p><span id="more-2679"></span><br />
The citrus-config.xml for this test case can be found <a href="http://www.redstream.nl/wp-content/uploads/2011/04/citrus-context.xml">here</a>. I will explain the content of the config file next:</p>

<div class="wp_codebox"><table><tr id="p267928"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p2679code28"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;citrusJMSConnectionFactory&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;brokerURL&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;vm://localhost:61616&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;userName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;user&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;password&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>This part defines a &#8216;in-memory&#8217; JMS provider to be used by Citrus. We will see later how we use it to check the incoming HTTP request (as described <a href="http://www.citrusframework.org/reference/html/index.html#http-message-handler-jms">here</a> in the Citrus reference guide).</p>

<div class="wp_codebox"><table><tr id="p267929"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2679code29"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;namespaceContextBuilder&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.xml.namespace.NamespaceContextBuilder&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;namespaceMappings&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;props<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;prop</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;ns1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>http://www.redstream.nl/invoice<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/prop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/props<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Here we define the namespaces that are used in the xml messages in our test. We will use this namespace in the test to check values of certain XML elements.</p>

<div class="wp_codebox"><table><tr id="p267930"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p2679code30"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;redstreamIntegrationTests&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.TestSuite&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;tasksBefore&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.actions.ExecuteSQLAction&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;rsDataSource&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;statements&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>DELETE FROM RS_LOGS<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>With this part I have Citrus clean up my log table in the database of my Mule ESB. We log all incoming and outgoing messages in our ESB to the database.</p>

<div class="wp_codebox"><table><tr id="p267931"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p2679code31"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- manadatory if XML files are used in a test --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;xmlMessageValidator&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.validation.xml.DomXmlMessageValidator&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;schemaRepository&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.xml.XsdSchemaRepository&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;schemas&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.xml.xsd.SimpleXsdSchema&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;xsd&quot;</span></span>
<span style="color: #009900;">                               <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;classpath:schemas/rs_invoice_0.3.xsd&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>When you want to work with XML messages in your test (and that is very likely nowadays) you will need to define an &#8216;xmlMessageValidator&#8217;. And to be able to validate the message against an XML schema you will need to define the schemas in the &#8216;schemaRepository&#8217; as I have done here.</p>

<div class="wp_codebox"><table><tr id="p267932"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2679code32"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;rsDataSource&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.commons.dbcp.BasicDataSource&quot;</span> <span style="color: #000066;">destroy-method</span>=<span style="color: #ff0000;">&quot;close&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;jdbc:oracle:thin:@test-vm:1521:XE&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;user&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;password&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;driverClassName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;oracle.jdbc.xa.client.OracleXADataSource&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;removeAbandoned&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>This is the datasource that Citrus can use to access the database that is used by our Mule ESB application. We use this datasource to clean up the logtable and can use it to perform validations after messages have been processed.</p>

<div class="wp_codebox"><table><tr id="p267933"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2679code33"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;citrus:message-channel-sender</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;invoiceFileSender&quot;</span> <span style="color: #000066;">channel</span>=<span style="color: #ff0000;">&quot;fileOutboundChannel&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file:outbound-channel-adapter</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;invoice-files-out&quot;</span> <span style="color: #000066;">channel</span>=<span style="color: #ff0000;">&quot;fileOutboundChannel&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">directory</span>=<span style="color: #ff0000;">&quot;file://Volumes/staging/invoice&quot;</span> <span style="color: #000066;">filename-generator</span>=<span style="color: #ff0000;">&quot;test-filename-generator&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;test-filename-generator&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;nl.redstream.citrus.TestFileNameGenerator&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;si:channel</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;fileOutboundChannel&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>This is a mix of Citrus with spring-integration configuration. With this configuration I am able to send files to my test VM with Citrus. It also shows how easy it is to mix Citrus with spring-integration.</p>

<div class="wp_codebox"><table><tr id="p267934"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2679code34"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- receive Invoice HTTP request --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;citrus-http:server</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;orderHttpServer&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;8060&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">&quot;/services/post-invoice&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">deamon</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">message-handler</span>=<span style="color: #ff0000;">&quot;jmsForwardingMessageHandler&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">auto-start</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>Definition of the HTTP Server in Citrus which listens on port 8060 for a request of our Mule ESB.</p>

<div class="wp_codebox"><table><tr id="p267935"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p2679code35"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jmsForwardingMessageHandler&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.adapter.handler.JmsConnectingMessageHandler&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;destinationName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Citrus.order-response&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;connectionFactory&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;citrusJMSConnectionFactory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;replyTimeout&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;6000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Process all received requests --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;citrus:jms-sync-message-receiver</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;orderRequestReceiver&quot;</span></span>
<span style="color: #009900;">                            <span style="color: #000066;">destination-name</span>=<span style="color: #ff0000;">&quot;Citrus.order-response&quot;</span></span>
<span style="color: #009900;">                            <span style="color: #000066;">connection-factory</span>=<span style="color: #ff0000;">&quot;citrusJMSConnectionFactory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;citrus:jms-reply-message-sender</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;orderResponseSender&quot;</span></span>
<span style="color: #009900;">                            <span style="color: #000066;">reply-destination-holder</span>=<span style="color: #ff0000;">&quot;orderRequestReceiver&quot;</span></span>
<span style="color: #009900;">                            <span style="color: #000066;">connection-factory</span>=<span style="color: #ff0000;">&quot;citrusJMSConnectionFactory&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>THis part forwards the incoming HTTP request to a JMS endpoint. In our test we can perform tests on this incoming JMS message and check if it is valid.</p>
<p>Next thing I want to explain is the test-config.xml itself. I think it is quite self-explainatory:</p>

<div class="wp_codebox"><table><tr id="p267936"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code" id="p2679code36"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring:beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.citrusframework.org/schema/testcase&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">xmlns:ws</span>=<span style="color: #ff0000;">&quot;http://www.citrusframework.org/schema/ws/testcase&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">xmlns:spring</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans</span>
<span style="color: #009900;">              http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</span>
<span style="color: #009900;">                  http://www.citrusframework.org/schema/ws/testcase</span>
<span style="color: #009900;">                  http://www.citrusframework.org/schema/ws/testcase/citrus-ws-testcase.xsd</span>
<span style="color: #009900;">                  http://www.citrusframework.org/schema/testcase</span>
<span style="color: #009900;">                  http://www.citrusframework.org/schema/testcase/citrus-testcase.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testcase</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Testcase001Test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-info<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Redstream Development Team<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;creationdate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2011-04-24<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/creationdate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;status<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>DRAFT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/status<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/meta-info<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Tests Testcase001<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;actions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;send</span> <span style="color: #000066;">with</span>=<span style="color: #ff0000;">&quot;invoiceFileSender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;classpath:data/testcase001.txt&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/send<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;receive</span> <span style="color: #000066;">with</span>=<span style="color: #ff0000;">&quot;orderRequestReceiver&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message</span> <span style="color: #000066;">schema-validation</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;validate</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;//ns1:post-invoice/ns1:CompanyCode&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;validate</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;string:count(//ns1:post-invoice/ns1:InvoiceLine/ns1:DocID)&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;3&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;header<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;element</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;rs_address&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;order-purchase-invoice-queue&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/header<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;extract<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;count(//ns1:post-invoice/ns1:InvoiceLine/ns1:DocID)&quot;</span> <span style="color: #000066;">variable</span>=<span style="color: #ff0000;">&quot;${nrOfInvoiceLines}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/extract<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/receive<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${nrOfInvoiceLines}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;send</span> <span style="color: #000066;">with</span>=<span style="color: #ff0000;">&quot;orderResponseSender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;classpath:data/response-testcase001.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/message<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/send<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/actions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testcase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring:beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The first action that is done is sending a file to my Mule ESB. The next step is that I wait for the response from my ESB. When I received that I check the contents of XML message at some points and check if it is valid against the schema.<br />
Then after echoing the number of invoice lines I have Citrus return the HTTP request with a fixed XML response so the Mule ESB ends this action successfully.<br />
That completes this example of how to use Citrus to test your ESB implemention. I hope it is more clear now how you can use Citrus  for your (automated) integration tests with this real life example.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/04/30/citrus-testcase-example-csv-file-inbound-xml-http-outbound/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setup Citrus for testing Mule ESB</title>
		<link>http://www.redstream.nl/2011/04/15/setup-citrus-for-testing-mule-esb/</link>
		<comments>http://www.redstream.nl/2011/04/15/setup-citrus-for-testing-mule-esb/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 11:50:27 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mule2]]></category>
		<category><![CDATA[Citrus]]></category>
		<category><![CDATA[Integration Test]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2634</guid>
		<description><![CDATA[Recently, I ran into an open-source test framework called Citrus. Citrus supports you in testing message interfaces in enterprise applications. Manual testing effort as well as coding mocks and simulators are not necessary. Instead Citrus enables integration testing in an &#8230; <a href="http://www.redstream.nl/2011/04/15/setup-citrus-for-testing-mule-esb/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F04%2F15%2Fsetup-citrus-for-testing-mule-esb%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F04%2F15%2Fsetup-citrus-for-testing-mule-esb%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently, I ran into an open-source test framework called <a href="http://www.citrusframework.org/">Citrus</a>. Citrus supports you in testing message interfaces in enterprise applications. Manual testing effort as well as coding mocks and simulators are not necessary. Instead Citrus enables integration testing in an automated way with out-of-the-box simulation of various message transports. We&#8217;ll use it to test our <a href="http://www.mulesoft.com/mule-esb-open-source-esb">Mule</a> based ESB.</p>
<p>Mule, of course, offers great possibility to unit test your application. And we also have a test setup which &#8216;talks&#8217; to other applications. What we didn&#8217;t have was a testing environment which we could use to test the ESB as a blackbox without being dependent on other (external) applications. And this is exactly where Citrus comes in. Citrus makes it possible to test the complete lifecycle of a message flow without being dependent of other systems, actually with Citrus you proxy these dependencies.<br />
In this post I will provide details and tips on how to setup and use Citrus. Although <a href="http://www.citrusframework.org/reference/html/index.html">the documentation</a> that is available is easy to read, it is not complete. It took me quite some effort to get it all running but like I said before the benefits of this framework are huge.<br />
<span id="more-2634"></span><br />
In the reference guide of Citrus there is a <a href="http://www.citrusframework.org/reference/html/index.html#setup-using-maven">chapter</a> about how to use Citrus with Maven. I use that guide as base and add some info that was missing in my case but is essential to get things working. I use the 1.2-SNAPSHOT edition of Citrus.</p>
<p>I took the following steps to get it running:</p>
<ol>
<li>Add repositories to your settings.xml</li>
<p>To have access to the Citrus jars you need to tell Maven where to get them. You can do this by adding the following repositories to your settings.xml (or even better to <a href="http://www.jfrog.com/products.php">Artifactory</a> or similar repository manager):</p>

<div class="wp_codebox"><table><tr id="p263441"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code" id="p2634code41"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;repositories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    [...]
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>consol-labs-release<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://labs.consol.de/maven/repository/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;snapshots<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/snapshots<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;releases<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/releases<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>consol-labs-snapshots<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://labs.consol.de/maven/snapshots-repository/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;snapshots<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- Policy: always, daily, interval:xxx (xxx=#minutes, 60*24*7=10080), never --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updatePolicy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>10080<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updatePolicy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/snapshots<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;releases<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/enabled<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/releases<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/repository<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    [...]
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/repositories<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<li>Add necessary dependencies to your project&#8217;s pom</li>
<p>Add the following dependencies to the pom of your project (at least the citrus-core, the others are depending on the tests you want to perform).</p>

<div class="wp_codebox"><table><tr id="p263442"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p2634code42"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>dependency<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>groupId<span style="color: #339933;">&gt;</span>com.<span style="color: #006633;">consol</span>.<span style="color: #006633;">citrus</span><span style="color: #339933;">&lt;/</span>groupId<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>artifactId<span style="color: #339933;">&gt;</span>citrus<span style="color: #339933;">-</span>core<span style="color: #339933;">&lt;/</span>artifactId<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>version<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">1.2</span><span style="color: #339933;">-</span>SNAPSHOT<span style="color: #339933;">&lt;/</span>version<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>scope<span style="color: #339933;">&gt;</span>test<span style="color: #339933;">&lt;/</span>scope<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>dependency<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>dependency<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>groupId<span style="color: #339933;">&gt;</span>com.<span style="color: #006633;">consol</span>.<span style="color: #006633;">citrus</span><span style="color: #339933;">&lt;/</span>groupId<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>artifactId<span style="color: #339933;">&gt;</span>citrus<span style="color: #339933;">-</span>http<span style="color: #339933;">&lt;/</span>artifactId<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>version<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">1.2</span><span style="color: #339933;">-</span>SNAPSHOT<span style="color: #339933;">&lt;/</span>version<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>scope<span style="color: #339933;">&gt;</span>test<span style="color: #339933;">&lt;/</span>scope<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>dependency<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>dependency<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>groupId<span style="color: #339933;">&gt;</span>com.<span style="color: #006633;">consol</span>.<span style="color: #006633;">citrus</span><span style="color: #339933;">&lt;/</span>groupId<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>artifactId<span style="color: #339933;">&gt;</span>citrus<span style="color: #339933;">-</span>adapter<span style="color: #339933;">&lt;/</span>artifactId<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>version<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">1.2</span><span style="color: #339933;">-</span>SNAPSHOT<span style="color: #339933;">&lt;/</span>version<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>scope<span style="color: #339933;">&gt;</span>test<span style="color: #339933;">&lt;/</span>scope<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;/</span>dependency<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<li>Add necessary plugins to your project&#8217;s pom</li>
<p>To generate and execute the Citrus test cases you need to add the Citrus plugins (and extra source path) to your project. This is done by adding the following to your project&#8217;s pom:</p>

<div class="wp_codebox"><table><tr id="p263443"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
</pre></td><td class="code" id="p2634code43"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-compiler-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/source<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.sourceEncoding}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-resources-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.sourceEncoding}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/encoding<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.consol.citrus.mvn<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>citrus-maven-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Redstream Team<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;targetPackage<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>nl.redstream.test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/targetPackage<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-surefire-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;skip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/skip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>citrus-tests<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;skip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/skip<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testSourceDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/citrus/java<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testSourceDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testResources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testResource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/citrus/java<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>**<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.java<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exclude<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testResource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testResource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/citrus/tests<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>**/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testResource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testResource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>src/citrus/resources<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>**/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/include<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/includes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/excludes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testResource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testResources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<li>Create a Citrus Test Case</li>
<p>Next step is to use the Maven plugin to create a new Test Case. Run the command </p>
<blockquote><p>mvn citrus:create-test</p></blockquote>
<p> and answer the questions.<br />
Note 1: the name of the testcase is going to be the Java class name so only use the valid characters for a Java class name<br />
Note 2: Make sure the name of the testcase ends with &#8216;Test&#8217; otherwise the test isn&#8217;t found when trying to run it (at least in case you generate a JUnit4 type of test).</p>
<li>Add a &#8216;citrus-context.xml&#8217; to the classpath</li>
<p>This isn&#8217;t mentioned in the guide but is a mandatory step: you need to have a &#8216;citrus-context.xml&#8217; file on the classpath for Citrus to run your tests. Here is a snippet from the config file that can be found in the examples that are delivered with Citrus:</p>

<div class="wp_codebox"><table><tr id="p263444"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code" id="p2634code44"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:citrus</span>=<span style="color: #ff0000;">&quot;http://www.citrusframework.org/schema/config&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:citrus-ws</span>=<span style="color: #ff0000;">&quot;http://www.citrusframework.org/schema/ws/config&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:citrus-http</span>=<span style="color: #ff0000;">&quot;http://www.citrusframework.org/schema/http/config&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:context</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/context&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</span>
<span style="color: #009900;">       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd</span>
<span style="color: #009900;">       http://www.citrusframework.org/schema/config http://www.citrusframework.org/schema/config/citrus-config.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
...
    <span style="color: #808080; font-style: italic;">&lt;!-- Message Validators --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;xmlMessageValidator&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.validation.xml.DomXmlMessageValidator&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;connectionFactory&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.activemq.ActiveMQConnectionFactory&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;brokerURL&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${jms.server.url}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.variable.GlobalVariables&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;variables&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;project.name&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Citrus Greeting sample&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
...
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- TestSuite definition --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;citrus-samples-greeting&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.consol.citrus.TestSuite&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

</ol>
<p>When all this is done you can run your test with the command:</p>
<blockquote><p>mvn clean integration-test -Dtest=YourTestNameTest</p></blockquote>
<p>In the next posts I will go into more detail about certain Test Scenarios and how to test these with Citrus.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/04/15/setup-citrus-for-testing-mule-esb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XSLT 2.0 and Java Extensions</title>
		<link>http://www.redstream.nl/2011/03/29/xslt-2-0-and-java-extensions/</link>
		<comments>http://www.redstream.nl/2011/03/29/xslt-2-0-and-java-extensions/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 19:12:55 +0000</pubDate>
		<dc:creator>Pascal Prins</dc:creator>
				<category><![CDATA[MapForce]]></category>
		<category><![CDATA[Mule]]></category>
		<category><![CDATA[XML/ XSD/ XSLT]]></category>

		<guid isPermaLink="false">http://www.redstream.nl/?p=2598</guid>
		<description><![CDATA[We use a fair lot of XSLT transformations in our projects. Since making XSLT stylesheets is a tedious and error-prone job, we use Altova MapForce to do the job. MapForce is very versatile, but can not always cope with the &#8230; <a href="http://www.redstream.nl/2011/03/29/xslt-2-0-and-java-extensions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F03%2F29%2Fxslt-2-0-and-java-extensions%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2011%2F03%2F29%2Fxslt-2-0-and-java-extensions%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>We use a fair lot of XSLT transformations in our projects. Since making XSLT stylesheets is a tedious and error-prone job, we use <a href="http://www.altova.com/mapforce.html" target="_blank">Altova MapForce</a> to do the job. MapForce is very versatile, but can not always cope with the requirements our customers come up with. This time, the customer asked us to implement some sort of maintainable translation mechanism. This mechanism should be able to translate incoming values using a user maintainable collection of values. This way, the transformation process does not need to be changed if a translation is added or updated.</p>
<p>Adding a (hardcoded) parameterized XSLT template is not an option, because this is not maintainable without changing the stylesheet. The answer? XSLT Java extensions!</p>
<p>In this blog I&#8217;ll show you a simple example on how to use Java extensions in a XSLT 2.0 stylesheet.</p>
<p><span id="more-2598"></span></p>
<p>We&#8217;ll start with a very simple &#8220;Hello World!&#8221;-isch example. I&#8217;ve created the following Java class which we will be using in our stylesheet:</p>
<h3>Our custom Java class</h3>

<div class="wp_codebox"><table><tr id="p259849"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p2598code49"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">nl.redstream.utils</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Properties</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> XsltUtils <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Your default Hello World! method.
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> greeting<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;Hello, &quot;</span> <span style="color: #339933;">+</span> name <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; !&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Notice that the <code>greeting</code> method is <code>public static</code> (not really needed, but makes things easier) .</p>
<p>I packaged the project into a single jar (let&#8217;s assume it is called: <code>redstream-xslt-demo-1.0-SNAPSHOT.jar</code>) using <code>mvn clean package</code>.</p>
<h3>The XSL stylesheet</h3>
<p>Next up, creating our stylesheet ! (We will be dealing with the jar later) Use the following stylesheet:</p>

<div class="wp_codebox"><table><tr id="p259850"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p2598code50"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:stylesheet</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.0&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:xsl</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/XSL/Transform&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:fn</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2005/xpath-functions&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:demo</span>=<span style="color: #ff0000;">&quot;java:nl.redstream.utils.XsltUtils&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">exclude-result-prefixes</span>=<span style="color: #ff0000;">&quot;fn demo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:output</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;xml&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span> <span style="color: #000066;">indent</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:template</span> <span style="color: #000066;">match</span>=<span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:for-each</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;dataset&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:for-each</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;row/column&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;@name&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsl:attribute</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;value&quot;</span> <span style="color: #000066;">select</span>=<span style="color: #ff0000;">&quot;demo:greeting(fn:string(@value))&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/column<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:for-each<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:for-each<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:template<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/xsl:stylesheet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Notice two things:<br />
- <strong>Line 5</strong> contains a declaration of our custom namespace. Just <code>java:</code> and the FQN of your custom Java class. The prerequisite is that the class (optionally packaged in a jar) is on the classpath.<br />
- <strong>Line 15</strong> contains a reference to our Java function. Notice that you can use an Xpath expression which will be resolved at runtime and passed as an argument to the <code>greeting</code> method.</p>
<h3>Disclaimer</h3>
<p>Remember the declaration of the namespace? This is dependent of the used XSLT engine. When using Saxon, you have to use the <code>java:FQN</code> declaration. When you are using Xalan, for example, you use <code>xalan://FQN</code>. Please check the documentation of your selected XSLT engine, before you declare the namespace.</p>
<h3>XMLSpy</h3>
<p>We could perform the XSL transformation using the command line, but we are using <a target="_blank" href="http://www.altova.com/xml-editor/">Altova XMLSpy</a> for this. By default, XMLSpy uses a built-in XSLT engine, but this can be changed to a custom one. Goto: &#8220;Tools -> Options: External XSL transformation program&#8221; and copy-paste the following: <code>java -cp C:\develop\redstream-xslt-demo-1.0-SNAPSHOT.jar;C:\develop\saxon8.jar net.sf.saxon.Transform -o %2 %1 %3</code>.</p>
<p>We will be using <a target="_blank" href="http://saxon.sourceforge.net/">Saxon</a> as XSLT engine, because the endresult will be packaged in a Mule ESB application &#8230; and Mule uses Saxon (so, that&#8217;s why). Should you want to use another XSLT engine, customize the &#8216;External XSL transformation program&#8217; in XMLSpy accordingly. Notice that all necessary jar&#8217;s are copied to the <code>c:\develop</code> directory and included in the classpath (including our custom jar).</p>
<p>Assign the following XML to the XSL using <code>XSL/XQuery -> Assign sample XML file</code>:</p>

<div class="wp_codebox"><table><tr id="p259851"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2598code51"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;greeting&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;foo&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;another&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;bar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>After pressing F10 the following output should be the result of the transformation:</p>

<div class="wp_codebox"><table><tr id="p259852"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2598code52"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dataset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;greeting&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Hello, foo !&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;another&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Hello, bar !&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/row<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dataset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>What&#8217;s happened is that values <code>foo</code> and <code>bar</code> were passed to the Java <code>greeting</code> method and returned the displayed string. Of course this is a simplified example, but you&#8217;ll catch the drift. This opens up possibilites: you now can breakout of the XSLT 2.0 barriers and use Java where needed. Use your imagination to create your own custom Java class.</p>
<p>That&#8217;s it &#8230; we&#8217;ve shown that you can use custom Java classes in your XSLT 2.0 transformation. In my next post, I&#8217;ll show you how to extend Altova MapForce and make this reusable (read: drag-and-drop the Java methods graphically to auto generate the XSLT 2.0 stylesheet).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2011/03/29/xslt-2-0-and-java-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

