<?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; CXF</title>
	<atom:link href="http://www.redstream.nl/tag/cxf/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>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="p29023"><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="p2902code3"><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="p29024"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2902code4"><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>Mule and the &quot;Attempted read from closed stream&quot;-exception</title>
		<link>http://www.redstream.nl/2010/07/25/mule-and-the-attempted-read-from-closed-stream-exception/</link>
		<comments>http://www.redstream.nl/2010/07/25/mule-and-the-attempted-read-from-closed-stream-exception/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 12:57:17 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Mule]]></category>
		<category><![CDATA[CXF]]></category>

		<guid isPermaLink="false">http://blog.redstream.nl/?p=1916</guid>
		<description><![CDATA[When you are using a certain version of Mule ESB you are going to run into an existing bug sooner or later. That isn&#8217;t really a problem, I would call it inevitable (at least based on my own experience). The &#8230; <a href="http://www.redstream.nl/2010/07/25/mule-and-the-attempted-read-from-closed-stream-exception/">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%2F2010%2F07%2F25%2Fmule-and-the-attempted-read-from-closed-stream-exception%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2010%2F07%2F25%2Fmule-and-the-attempted-read-from-closed-stream-exception%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>When you are using a certain version of  <a href="http://www.mulesoft.org/">Mule ESB</a> you are going to run into an existing bug sooner or later. That isn&#8217;t really a problem, I would call it inevitable (at least based on my own experience). The big advantage of the open source idea is that you can dive into the source code and see where the problem is caused and fix it ( or at least work around it). I remember the time I was using Oracle Forms Developer to build applications. When you ran into a bug you had to wait until Oracle was ready to fix/patch it (or, of course, convince the client to not want that specific feature in their application).<br />
Although its true you can find all known bugs for Mule in <a href="http://www.mulesoft.org/jira/browse/">Jira</a>, you still have to discover yourself your application is having a problem with that known issue.  I recently implemented a new interface in our application and I started to make use of <a href="http://www.mulesoft.org/documentation/display/CXF/Home">the CXF transport</a> (until now it was mainly based on JMS and VM). The exception I got when processing a message was</p>
<blockquote><p>java.io.IOException: Attempted read from closed stream.</p></blockquote>
<p> The weird thing was, I didn&#8217;t get this exception when running my unit tests and it sometimes even worked in my deployed application.<br />
As I said we got this exception when we added the CXF endpoint, although we did it as described <a href="http://www.mulesoft.org/documentation/display/MULE2USER/Building+a+CXF+Web+Service">in the manual</a>. Well, to make a long story short, it appeared we were running into <a href="http://www.mulesoft.org/jira/browse/MULE-4096">this</a> issue. In our deployed version we make use of the <a href="http://www.mulesoft.org/documentation/display/MULE2USER/Mule+Server+Notifications">Mule Notifications</a>. We have extended the default Mule endpoints so they can indicate if a message they are processing should be logged. This logging is done by receiving the Notification and extracting the message from it. Then we log the payload of the MuleMessage as text in our database.<br />
This works great as long the payload of the message isn&#8217;t an InputStream! in case of an InputStream the  stream is read to make a String of it and since a InputStream can only be read once, the rest of the application cannot read it again (hence the &#8216;<em>Attempted read from closed stream</em>&#8216;). This behaviour is described in <a href="http://www.mulesoft.org/jira/browse/MULE-4096">Jira</a> but you can image that it took some time before we realized we were running into this. Especially because the stack trace isn&#8217;t of much use in this case since it is pointing to some deep down CXF code that tries to read the input stream.<br />
Next time someone has a similar issue and you are using Notification Handlers you might want to check these out and this way save yourself a lot of time looking for the cause of this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2010/07/25/mule-and-the-attempted-read-from-closed-stream-exception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mule2, CXF and serializable classes</title>
		<link>http://www.redstream.nl/2009/07/01/mule2-cxf-and-serializable-classes/</link>
		<comments>http://www.redstream.nl/2009/07/01/mule2-cxf-and-serializable-classes/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 19:25:17 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Mule]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[CXF]]></category>
		<category><![CDATA[JAX-WS]]></category>
		<category><![CDATA[JAXB]]></category>

		<guid isPermaLink="false">http://www.pascalalma.net/?p=890</guid>
		<description><![CDATA[This post is one of the series of posts about issues that occurred when we were using Mule2 in a real life project. As I wrote in my last post we were using CXF to call a webservice with Mule. &#8230; <a href="http://www.redstream.nl/2009/07/01/mule2-cxf-and-serializable-classes/">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%2F2009%2F07%2F01%2Fmule2-cxf-and-serializable-classes%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2009%2F07%2F01%2Fmule2-cxf-and-serializable-classes%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This post is one of the series of posts about issues that occurred when we were using <a href="http://www.mulesource.org/display/MULE2INTRO/Home">Mule2</a> in a real life project. As I wrote in <a href="http://www.redstream.nl/2009/06/27/mule2-cxf-and-http-chunking/">my last post</a> we were using <a href="http://cxf.apache.org/">CXF</a> to call a webservice with Mule. After the issues we ran into as described in that article, we ended up with the folowing issue. The generated classes that are used for the XML to Java mapping has to be serializable. This is possible by using a binding file when generating the classes with Maven as described in the documentation <a href="http://cwiki.apache.org/CXF20DOC/wsdl-to-java.html">here</a>.<br />
However, I haven&#8217;t been able to do this in my situation. And according to <a href="http://www.nabble.com/How-to-make-classes-created-from-wsdl2java-implements-serializable--td14246207.html">this post</a> I am not the only one. So to keep the project moving I decided to make use of <a href="https://jax-ws.dev.java.net/">Metro JAX-WS</a> instead of CXF, since this CXF thing had cost us enough of our precious time. With the Metro implementation we had it running in no time without any unexpected issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2009/07/01/mule2-cxf-and-serializable-classes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mule2, CXF and http chunking</title>
		<link>http://www.redstream.nl/2009/06/27/mule2-cxf-and-http-chunking/</link>
		<comments>http://www.redstream.nl/2009/06/27/mule2-cxf-and-http-chunking/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 09:47:58 +0000</pubDate>
		<dc:creator>Pascal Alma</dc:creator>
				<category><![CDATA[Mule]]></category>
		<category><![CDATA[CXF]]></category>

		<guid isPermaLink="false">http://www.pascalalma.net/?p=883</guid>
		<description><![CDATA[This post is one of the series of posts about issues that occurred when we were using Mule2 in a real life project. One of the things we had to do with Mule is communicating with a web service. This &#8230; <a href="http://www.redstream.nl/2009/06/27/mule2-cxf-and-http-chunking/">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%2F2009%2F06%2F27%2Fmule2-cxf-and-http-chunking%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.redstream.nl%2F2009%2F06%2F27%2Fmule2-cxf-and-http-chunking%2F&amp;source=redstreamlive&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This post is one of the series of posts about issues that occurred when we were using <a href="http://www.mulesource.org/display/MULE2INTRO/Home">Mule2</a> in a real life project. One of the things we had to do with Mule is communicating with a web service. This seemed not to difficult for a tool like Mule that is just build for interaction with other systems. This turned out to be different. We decided to use the <a href="http://www.mulesource.org/display/MULE2USER/CXF+Transport">CXF transport</a> that comes standard with Mule. However, the web server we were calling was only able to &#8216;speak&#8217; via HTTP1.0 and therefor didn&#8217;t understand &#8216;chunking&#8217;.  That led to the following error:<br />
<code>java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode</code><span id="more-883"></span><br />
After lot of googling and searching I found <a href="http://techpolesen.blogspot.com/2007/08/javanethttpretryexception-cannot-retry.html">this post</a> that gave us an idea how to solve the problem. We decided to generate CFX client classes and create a Java client for our web service call. That Java class is then configured as a component in Mule.  The Java class contains the HTTPConduit code as is stated in the post I mentioned. This got it to work. Afterwards I found <a href="http://www.apsquare.com/palmalex/?p=68">another post</a> that solves this same issue but in another way. I haven&#8217;t tried it but it looks nice because you don&#8217;t have to write any code, only some xml in the Mule config.<br />
But the best solution would be if the supplied &#8216;cxf.xml&#8217; config file is picked up by Mule in version 2.2.1 so you can arrange it there as it should be working (see some posts <a href="http://forums.mulesource.org/thread.jspa?threadID=1223">here</a> and <a href="http://archive.hausfoundation.org/lists/org.codehaus.mule.user/msg/20453682.post@talk.nabble.com">here</a> about this issue).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redstream.nl/2009/06/27/mule2-cxf-and-http-chunking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

