<?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>Java, Programming, Struts2, jQuery, Linux and more &#187; Allgemein</title>
	<atom:link href="http://www.jgeppert.com/category/allgemein/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jgeppert.com</link>
	<description>Johannes Geppert</description>
	<lastBuildDate>Thu, 09 Feb 2012 16:38:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Version 2.2.0 of Struts2 jQuery Plugin is now available</title>
		<link>http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/</link>
		<comments>http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 19:55:17 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[projekte]]></category>
		<category><![CDATA[Struts jQuery Plugin]]></category>
		<category><![CDATA[struts2]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ckeditor]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[jqgrid]]></category>
		<category><![CDATA[jqueryui]]></category>
		<category><![CDATA[richtext]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=395</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/' addthis:title='Version 2.2.0 of Struts2 jQuery Plugin is now available '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Version 2.2.0 of Struts2 jQuery Plugin is out now. The new Version is Based on latest jQuery UI 1.8.2, see Changelog for more Detail about this version. Changes since Version 2.1.0: Upgrade to jQuery UI 1.8.2 Upgrade to jqGrid 3.6.5 Solve &#160;Issue 154&#160;: load from google cdn does not work for jquery ui themes Solve [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/' addthis:title='Version 2.2.0 of Struts2 jQuery Plugin is now available ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/' addthis:title='Version 2.2.0 of Struts2 jQuery Plugin is now available '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Version 2.2.0 of <a href="http://code.google.com/p/struts2-jquery/">Struts2 jQuery Plugin</a> is out now. The new Version is Based on <a href="http://blog.jqueryui.com/2010/06/jquery-ui-182/">latest jQuery UI 1.8.2</a>, see Changelog for more Detail about this version.


<strong>Changes since Version 2.1.0:</strong>

<ul>
<li>Upgrade to jQuery UI 1.8.2</li>
<li>Upgrade to jqGrid 3.6.5</li>
<li>Solve <a title="load from google cdn does not work for jquery ui themes" class="closed_ref" href="http://code.google.com/p/struts2-jquery/issues/detail?id=154">&nbsp;Issue 154&nbsp;</a>: load from google cdn does not work for jquery ui themes </li>
<li>Solve <a title="Default Loading Text" href="http://code.google.com/p/struts2-jquery/issues/detail?id=155">Issue 155</a>: Default Loading Text </li>
<li>Solve <a title="onSelectAll topics" href="http://code.google.com/p/struts2-jquery/issues/detail?id=156">Issue 156</a>: onSelectAll topics </li>
<li>Solve <a title="useSelectedTabCookies in tabbedpanel broken in 2.1.0" class="closed_ref" href="http://code.google.com/p/struts2-jquery/issues/detail?id=157">&nbsp;Issue 157&nbsp;</a>: useSelectedTabCookies in tabbedpanel broken in 2.1.0 </li>
<li>Solve <a title="Select options vanish when re-entering the page" class="closed_ref" href="http://code.google.com/p/struts2-jquery/issues/detail?id=161">&nbsp;Issue 161&nbsp;</a>: Select options vanish when re-entering the page </li>
<li>Solve <a title="Struts2-jquery-plugin not recognizing tag in jsp page" class="closed_ref" href="http://code.google.com/p/struts2-jquery/issues/detail?id=170">&nbsp;Issue 170&nbsp;</a>: Struts2-jquery-plugin not recognizing tag in jsp page </li>
<li>Solve <a title="sj:accordion autoHeight does not work" class="closed_ref" href="http://code.google.com/p/struts2-jquery/issues/detail?id=171">&nbsp;Issue 171&nbsp;</a>: sj:accordion autoHeight does not work </li>
<li>Solve <a title="Autcompleter input textfield width should be configurable" class="closed_ref" href="http://code.google.com/p/struts2-jquery/issues/detail?id=176">&nbsp;Issue 176&nbsp;</a>: Autcompleter input textfield width should be configurable </li>
<li>Solve <a title="Nested tab didn't work" href="http://code.google.com/p/struts2-jquery/issues/detail?id=179">Issue 179</a>: Nested tab didn't work </li>
<li>Solve <a title="loadingText doesn't appear to have any effect with jqgrid plugin" href="http://code.google.com/p/struts2-jquery/issues/detail?id=184">Issue 184</a>: loadingText doesn't appear to have any effect with jqgrid plugin </li>
<li>Solve <a title="attributes hidegrid, hoverrows and shrinkToFit in grid tag can not be set to false" href="http://code.google.com/p/struts2-jquery/issues/detail?id=185">Issue 185</a>: attributes hidegrid, hoverrows and shrinkToFit in grid tag can not be set to false </li>
<li>Solve <a title="how to submit a  form while loading grid?" href="http://code.google.com/p/struts2-jquery/issues/detail?id=186">Issue 186</a>: how to submit a form while loading grid? </li>
<li>Solve <a title="Some locales does not work, particularly &quot;fr&quot;" href="http://code.google.com/p/struts2-jquery/issues/detail?id=188">Issue 188</a>: Some locales does not work, particularly "fr" </li>
<li>Solve <a title="Add Head Tag attribute 'compatibility' for an jQuery 1.3 compatibility mode" href="http://code.google.com/p/struts2-jquery/issues/detail?id=190">Issue 190</a>: Add Head Tag attribute 'compatibility' for an jQuery 1.3 compatibility mode </li>
<li>Solve <a title="deferred loading of dynamic elements  " href="http://code.google.com/p/struts2-jquery/issues/detail?id=191">Issue 191</a>: deferred loading of dynamic elements  </li>
<li>Solve <a title="Default Error Text" href="http://code.google.com/p/struts2-jquery/issues/detail?id=192">Issue 192</a>: Default Error Text </li>
<li>Solve <a title="Using base tag with sj:a causes page to reload" href="http://code.google.com/p/struts2-jquery/issues/detail?id=193">Issue 193</a>: Using base tag with sj:a causes page to reload </li>
</ul>

Download: <a href="http://code.google.com/p/struts2-jquery/downloads/list">http://code.google.com/p/struts2-jquery/downloads/list</a>
Showcase: <a href="http://www.weinfreund.de/struts2-jquery-showcase/">http://www.weinfreund.de/struts2-jquery-showcase/</a>
Issues: <a href="http://code.google.com/p/struts2-jquery/issues/list">http://code.google.com/p/struts2-jquery/issues/list</a>
User Group: <a href="http://groups.google.com/group/struts2-jquery">http://groups.google.com/group/struts2-jquery</a>

<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/' addthis:title='Version 2.2.0 of Struts2 jQuery Plugin is now available ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2010/06/version-2-2-0-of-struts2-jquery-plugin-is-now-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neues Video der Piratenpartei</title>
		<link>http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/</link>
		<comments>http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 14:43:57 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[piratenpartei]]></category>
		<category><![CDATA[piraten]]></category>
		<category><![CDATA[politik]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[wahlwerbung]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=296</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/' addthis:title='Neues Video der Piratenpartei '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Seit der Europawahl 2009 schafft es die Piratenpartei immer mehr Menschen anzuziehen. Doch wofür stehen die Piraten eigentlich? Seit gestern existiert ein neuer Wahlwerbespot der Piratenpartei der diese Frage beantworten soll.Ich finde das Video wirklich gelungen und es bringt die Forderungen der Piraten gut herüber.<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/' addthis:title='Neues Video der Piratenpartei ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/' addthis:title='Neues Video der Piratenpartei '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Seit der Europawahl 2009 schafft es die <a href="http://www.piratenpartei.de/">Piratenpartei</a> immer mehr Menschen anzuziehen.
Doch wofür stehen die Piraten eigentlich? Seit gestern existiert ein neuer Wahlwerbespot der Piratenpartei der diese Frage beantworten soll.<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/FtZBCi9WcIw" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed wmode="opaque" src="http://www.youtube.com/v/FtZBCi9WcIw" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>Ich finde das Video wirklich gelungen und es bringt die Forderungen der Piraten gut herüber.<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/' addthis:title='Neues Video der Piratenpartei ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2009/08/neues-video-der-piratenpartei/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RESTful Web Services (JAX-RS) mit Jersey</title>
		<link>http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/</link>
		<comments>http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 10:59:32 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[webservices]]></category>
		<category><![CDATA[jax-rc]]></category>
		<category><![CDATA[jersey]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=189</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/' addthis:title='RESTful Web Services (JAX-RS) mit Jersey '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Durch das Jersey Projekt existieren Bibliotheken die es Java Entwicklern besonders einfach machen REST Web Services zu entwickeln. In diesem Tutorial werde ich zeigen wie einfach es ist eine Web Service zu schreiben der uns einfache Mathematische Berechnung zurückliefert. 1.) Wir erstellen in unserer Entwicklungsumgebung, in meinem Beispiel Eclipse, ein Web Projekt.  In das WEB-INF/lib [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/' addthis:title='RESTful Web Services (JAX-RS) mit Jersey ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/' addthis:title='RESTful Web Services (JAX-RS) mit Jersey '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Durch das <a href="https://jersey.dev.java.net/">Jersey</a> Projekt existieren Bibliotheken die es Java Entwicklern besonders einfach machen REST Web Services zu entwickeln. In diesem Tutorial werde ich zeigen wie einfach es ist eine Web Service zu schreiben der uns einfache Mathematische Berechnung zurückliefert.

1.)
Wir erstellen in unserer Entwicklungsumgebung, in meinem Beispiel Eclipse, ein Web Projekt.  In das <strong>WEB-INF/lib</strong> Verzeichnis packen wir alle für Jersey benötigten JARs die es bei <a href="https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/jersey/dependencies.html">Jersey/Downloads</a> runterzuladen gibt.  Für dieses Tutorial benötigen wir folgende Bibliotheken:<a href="http://download.java.net/maven/2/com/sun/jersey/jersey-server/1.0.2/jersey-server-1.0.2.jar"> jersey-server.jar</a>, <a href="http://download.java.net/maven/2/com/sun/jersey/jersey-core/1.0.2/jersey-core-1.0.2.jar">jersey-core.jar</a>, <a href="http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar">jsr311-api.jar</a>, <a href="http://repo1.maven.org/maven2/asm/asm/3.1/asm-3.1.jar">asm.jar, </a><a href="http://download.java.net/maven/1/com.sun.xml.bind/jars/jaxb-impl-2.1.jar">jaxb-impl.jar</a>, <a href="http://download.java.net/maven/1/javax.xml.bind/jars/jaxb-api-2.1.jar">jaxb-api.jar</a>, <a href="http://download.java.net/maven/1/javax.activation/jars/activation-1.1.jar">activation.jar</a>, <a href="http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2.jar">stax-api.jar</a>

2.)
In unserer <strong>WEB-INF/web.xml</strong> fügen wir folgendes hinzu:


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>JAX-RS REST Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>REST-Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  		com.sun.jersey.spi.container.servlet.ServletContainer
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>REST-Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/services/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>




3.)
Wir erstellen zwei Klassen die wir für unser Ergebniss benötigen.

Die erste Klasse <strong>MathResults</strong> kapselt unsere Mathematischen Ergebnisse.


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wstest</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> MathResults <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> formel<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> ergebniss<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getFormel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> formel<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> setFormel<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> formel<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;">formel</span> <span style="color: #339933;">=</span> formel<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Integer</span> getErgebniss<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> ergebniss<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> setErgebniss<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> ergebniss<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;">ergebniss</span> <span style="color: #339933;">=</span> ergebniss<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>



Und die zweite Klasse <strong>ServiceResult</strong> ist das Result unseres WebService


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wstest</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.xml.bind.annotation.XmlRootElement</span><span style="color: #339933;">;</span>
&nbsp;
@XmlRootElement
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ServiceResult <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> message<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> returncode<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>MathResults<span style="color: #339933;">&gt;</span> ergebnisse<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Integer</span> getReturncode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> returncode<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> setReturncode<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> returncode<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;">returncode</span> <span style="color: #339933;">=</span> returncode<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getMessage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> message<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> setMessage<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> message<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;">message</span> <span style="color: #339933;">=</span> message<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>MathResults<span style="color: #339933;">&gt;</span> getErgebnisse<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> ergebnisse<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> setErgebnisse<span style="color: #009900;">&#40;</span>List<span style="color: #339933;">&lt;</span>MathResults<span style="color: #339933;">&gt;</span> ergebnisse<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;">ergebnisse</span> <span style="color: #339933;">=</span> ergebnisse<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>




4.)
Jetzt erstellen wir eine weitere Klasse <strong>CalculatorService</strong>, diese ist unser eigentlicher Webservice und wird durch Annotions als dieser gekennzeichnet. Ein gute Übersicht über zulässige Annotions findet Ihr im <a href="http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features">Wiki von Jersey</a>.


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">de.wstest</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.LinkedList</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>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.ws.rs.GET</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.ws.rs.Path</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.ws.rs.Produces</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.ws.rs.QueryParam</span><span style="color: #339933;">;</span>
&nbsp;
@Produces<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/xml&quot;</span><span style="color: #009900;">&#41;</span>
@Path<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;calculator&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CalculatorService <span style="color: #009900;">&#123;</span>
&nbsp;
	@GET
	@Path<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;calc&quot;</span><span style="color: #009900;">&#41;</span>
	@Produces<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/xml&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">public</span> ServiceResult add<span style="color: #009900;">&#40;</span>@QueryParam<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #003399;">Integer</span> a, @QueryParam<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;b&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #003399;">Integer</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		ServiceResult r <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ServiceResult<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		List<span style="color: #339933;">&lt;</span>MathResults<span style="color: #339933;">&gt;</span> ergs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LinkedList<span style="color: #339933;">&lt;</span>MathResults<span style="color: #339933;">&gt;</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;">if</span><span style="color: #009900;">&#40;</span>a <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">||</span> b <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>
			r.<span style="color: #006633;">setMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;No Values!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			r.<span style="color: #006633;">setReturncode</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			r.<span style="color: #006633;">setErgebnisse</span><span style="color: #009900;">&#40;</span>ergs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">return</span> r<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		r.<span style="color: #006633;">setMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Results for Value a = &quot;</span><span style="color: #339933;">+</span>a<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;, Value b = &quot;</span><span style="color: #339933;">+</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		r.<span style="color: #006633;">setReturncode</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		MathResults e1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MathResults<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		e1.<span style="color: #006633;">setFormel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;a + b&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		e1.<span style="color: #006633;">setErgebniss</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">+</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		MathResults e2 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MathResults<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		e2.<span style="color: #006633;">setFormel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;a - b&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		e2.<span style="color: #006633;">setErgebniss</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">-</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		MathResults e3 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MathResults<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		e3.<span style="color: #006633;">setFormel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;a * b&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		e3.<span style="color: #006633;">setErgebniss</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">*</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		ergs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>e1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		ergs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>e2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		ergs.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>e3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
		r.<span style="color: #006633;">setErgebnisse</span><span style="color: #009900;">&#40;</span>ergs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> r<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>




Fertig ist unsere RESTFull Webservice. Nach dem deployen in einem ServletContainer wie Tomcat erhalten wir nach einem Aufruf des Webservices im Browser

<em>http://localhost:8080/wstest/services/calculator/calc?a=234&amp;b=456</em>

folgendes Ergebniss:


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;serviceResult<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ergebnisse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ergebniss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>690<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ergebniss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;formel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>a + b<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/formel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ergebnisse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ergebnisse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ergebniss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>-222<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ergebniss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;formel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>a - b<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/formel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ergebnisse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ergebnisse<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ergebniss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>106704<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ergebniss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;formel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>a * b<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/formel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ergebnisse<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>Value a = 234, Value b = 456<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;returncode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/returncode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/serviceResult<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>




Durch einen Aufruf der URL

<em>http://localhost:8080/wstest/services/application.wadl</em>

erhalten wir eine Übersicht über unsere Services und deren Parameter.


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://research.sun.com/wadl/2006/10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;doc</span> <span style="color: #000066;">xmlns:jersey</span>=<span style="color: #ff0000;">&quot;http://jersey.dev.java.net/&quot;</span> <span style="color: #000066;">jersey:generatedBy</span>=<span style="color: #ff0000;">&quot;Jersey: 1.0 10/13/2008 12:27 PM&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources</span> <span style="color: #000066;">base</span>=<span style="color: #ff0000;">&quot;http://localhost:8080/wstest/services/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;calculator&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resource</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;calc&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;GET&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;add&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;request<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">xmlns:xs</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;xs:int&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;query&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;a&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param</span> <span style="color: #000066;">xmlns:xs</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;xs:int&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;query&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;b&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;/request<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;response<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;representation</span> <span style="color: #000066;">mediaType</span>=<span style="color: #ff0000;">&quot;application/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;/response<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/method<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 style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>




Fertig ist in wenigen Schritten unser REST Web Service der uns eine Liste von Berechnungen für einen Eingabe zurückliefert.
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/' addthis:title='RESTful Web Services (JAX-RS) mit Jersey ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2009/03/restful-web-services-jax-rs-mit-jersey/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Ein Webservice mit Axis2 und Spring</title>
		<link>http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/</link>
		<comments>http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 18:16:42 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[axis2]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[webservices]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=165</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/' addthis:title='Ein Webservice mit Axis2 und Spring '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Mit Axis2 ist das Erstellen von Webservices für Java Programmierer noch einfacher geworden. Mit folgendem kleinen Beispiel will ich zeigen, wie man einen Webservice programmieren kann, der von Spring ein Bean injiziert bekommt. Als Erstes erstellen wir unseren Webservice als einfache Java Klasse: package com.jgeppert.services; &#160; import com.jgeppert.dao.MyDAO; &#160; private MyDAO myDAO; &#160; public class [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/' addthis:title='Ein Webservice mit Axis2 und Spring ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/' addthis:title='Ein Webservice mit Axis2 und Spring '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Mit <a href="http://ws.apache.org/axis2/">Axis2</a> ist das Erstellen von Webservices für Java Programmierer noch einfacher geworden. Mit folgendem kleinen Beispiel will ich zeigen, wie man einen Webservice programmieren kann, der von <a href="http://www.springsource.org">Spring</a> ein Bean injiziert bekommt.
</p>
<p>
Als Erstes erstellen wir unseren Webservice als einfache Java Klasse:
</p>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.jgeppert.services</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.jgeppert.dao.MyDAO</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> MyDAO myDAO<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyWebService
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">/* Die Funktion add() ist unsere Webservice Operation die
	 * dann mit einem Client angesprochen werden kann.
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> add<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> text<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span>
		<span style="color: #009900;">&#123;</span>
			myDAO.<span style="color: #006633;">save</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;insert successfully&quot;</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><span style="color: #003399;">RuntimeException</span> e<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> e.<span style="color: #006633;">getMessage</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: #666666; font-style: italic;">// Mit dieser Methode injiziert uns Spring unser DAO Objekt</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> setMyDAO<span style="color: #009900;">&#40;</span>MyDAO myDAO<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;">myDAO</span> <span style="color: #339933;">=</span> myDAO<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>



<p>
Als Zweites brauchen wir für Aris2 eine service.xml mit folgendem Inhalt:
</p>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service<span style="color: #000000; font-weight: bold;">&gt;</span></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>My First WebService<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;parameter</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ServiceClass&quot;</span> <span style="color: #000066;">locked</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		com.jgeppert.services.MyWebService
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parameter</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ServiceObjectSupplier&quot;</span> <span style="color: #000066;">locked</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parameter</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;SpringBeanName&quot;</span> <span style="color: #000066;">locked</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>myWebService<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;operation</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;add&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;messageReceiver</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.axis2.rpc.receivers.RPCMessageReceiver&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/operation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>



<p>
Für Spring sind die zwei Parameter <strong>ServiceObjectSupplier</strong> und <strong>SpringBeanName</strong> entscheidend, um uns das benötigte DAO zu übergeben.

Mit Hilfe eines <a href="http://ws.apache.org/axis2/1_4_1/pojoguide.html#buildpojows">Ant Scriptes</a> oder manuell kann man sich den Webservice in das für Axis2 benötigte AAR Archiv packen. Das Archiv ist im Grunde eine normale JAR Datei mit der service.xml im META-INF Verzeichnis.
</p>
<p>
Die Struktur des AAR-Archives sollte so aus sehen:
</p>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">-</span> MyWebService
   <span style="color: #339933;">-</span> META<span style="color: #339933;">-</span>INF
     <span style="color: #339933;">-</span> services.<span style="color: #006633;">xml</span>
   <span style="color: #339933;">-</span> com
     <span style="color: #339933;">-</span> jgeppert
       <span style="color: #339933;">-</span> services
         <span style="color: #339933;">-</span> MyWebService.<span style="color: #000000; font-weight: bold;">class</span></pre></div></div>



<p>
Damit Spring unser DAO in dem Service injizieren kann, brauchen wir noch folgenden Eintrag in unserer applicationContext.xml.</p>


<div class="wp_syntax"><div class="code"><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;applicationContext&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder&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;myWebService&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.jgeppert.services.MyWebService&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;myDAO&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;MyDAO&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 style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>



<p>
Nach dem deployen des AAR-Archives im services Folder der Axis2 Web Application steht der Service nun zur Verfügung.
</p><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/' addthis:title='Ein Webservice mit Axis2 und Spring ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2009/02/webservice-mit-axis2-und-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Die Weincommunity wählt den besten Wein 2008</title>
		<link>http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/</link>
		<comments>http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 15:13:26 +0000</pubDate>
		<dc:creator>jogep</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[projekte]]></category>
		<category><![CDATA[onlineshop]]></category>
		<category><![CDATA[wein]]></category>
		<category><![CDATA[weinfreund]]></category>
		<category><![CDATA[weingut]]></category>

		<guid isPermaLink="false">http://www.jgeppert.com/?p=178</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/' addthis:title='Die Weincommunity wählt den besten Wein 2008 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Letzten September öffnete das Genießerportal www.weinfreund.de seine Pforten. Auf ihm können sich deutsche Winzer und österreichische Winzer mit ihren Weingütern präsentieren und gleichzeitig ihre Weine über einen Online-Shop anbieten. Derzeit präsentieren sich 80 Weingüter der Weinfreunde-Community. Die Community wählt dabei jährlich ihren liebsten Weiß- und Rotwein. Das Rennen machten bei der Wahl 2008 das Weingut [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/' addthis:title='Die Weincommunity wählt den besten Wein 2008 ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/' addthis:title='Die Weincommunity wählt den besten Wein 2008 '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Letzten September öffnete das Genießerportal <a title="Wein vom Weingut" href="http://www.weinfreund.de/">www.weinfreund.de</a> seine Pforten. Auf ihm können sich <a href="http://www.weinfreund.de/app/weingueter/deutschland">deutsche Winzer</a> und <a href="http://www.weinfreund.de/app/weingueter/oesterreich">österreichische Winzer</a> mit ihren Weingütern präsentieren und gleichzeitig ihre <a href="http://www.weinfreund.de/app/weingueter/shop">Weine über einen Online-Shop</a> anbieten. Derzeit präsentieren sich 80 Weingüter der Weinfreunde-Community. Die Community wählt dabei jährlich ihren liebsten Weiß- und Rotwein. Das Rennen machten bei der Wahl 2008 das <a title="Weingut Uebel" href="http://www.weinfreund.de/app/weingut/weingut-uebel">Weingut Uebel</a> aus der Pfalz mit seinem <strong>Cuvée blanc 2007</strong> und das <a title="Weingut Klaus Runkel" href="http://www.weinfreund.de/app/weingut/weingut-klaus-runkel">Weingut Klaus Runkel</a> mit seinem <a title="Bester Rotwein 2008" href="http://www.weinfreund.de/app/wein/merlot-m">Merlot ‚M‘ 2006</a>.

Auch dieses Jahr stehen wieder interessante neue Weine zur Wahl. Weinkenner, die sich an der Abstimmung beteiligen wollen, aber noch nicht zu den eingetragenen Weinfreunden gehören, können sich auf dem Genießerportal kostenlos anmelden. Wer sich bis 30. März dazu entschließt, der Community beizutreten, hat die Chance, einen guten Tropfen zu gewinnen. Auf die Gewinner wartet eine edle Weinauswahl der beiden Siegerweingüter Uebel und Klaus Runkel.

<strong>Cuvée blanc und Merlot sind die ‚besten‘ deutschen Weinen 2008</strong>

"Weine mit Charakter und eigener Persönlichkeit", so beschreibt Winzer Jochen Uebel seine Wein-Kollektion. Die Ausdruckskraft der Uebel-Weine kann die Community auf <a title="Weine aus Deurtschland und $Ouml;sterreich direkt vom Weingut" href="http://www.weinfreund.de/">www.weinfreund.de</a> nur bestätigen. Sie wählte den <strong>Cuvée blanc 2007</strong> zum Weißwein des Jahres 2008. Der zusätzlich goldprämierte Weißwein (Landesprämierung) zeichnet sich durch eine kaum zu übertreffende Vielfalt an fruchtigen und blumigen Aromen aus. Im Geschmack ist er ausgewogen und mineralisch zugleich mit einem langen würzigen Abgang.

Das <a title="Weingut Uebel aus der Pfalz" href="http://www.weinfreund.de/app/weingut/weingut-uebel">Weingut Uebel</a> ist eines der jungen Weingüter, die die <a title="Weine aus der Pfalz" href="http://www.weinfreund.de/app/anbaugebiet/pfalz">Pfalz</a> derzeit zum dynamischsten Weinbaugebiet Deutschlands macht. Es liegt in Nußdorf an der südlichen Weinstraße. Auf 10 Hektar gedeihen hier die Reben für Riesling, Chardonnay, Grauer Burgunder Sauvignon Blanc, Dornfelder, Portugieser, Merlot und Cabernet Sauvignon.

‚M‘ steht für den Gewinnerwein unter den Roten. Der <a title="Bester Rotwein 2008" href="http://www.weinfreund.de/app/wein/merlot-m">Merlot</a> aus dem Jahr 2006 vom <a title="Weingut Klaus Runkel" href="http://www.weinfreund.de/app/weingut/weingut-klaus-runkel">Weingut Klaus Runkel</a> besticht durch den Geschmack nach Waldbeeren und Dörrobst. Durch seine 18 monatige Lagerung hat der Wein zusätzlich feine Aromen von Tabak und Edelvollmilch Schokolade. Dafür bekam er auch die silberne Kammerpreismünze.

Das Familienweingut Klaus Runkel stammt aus der Weinbaugemeinde Bechtheim in <a title="Weine aus Rheinhessen" href="http://www.weinfreund.de/app/anbaugebiet/rheinhessen">Rheinhessen</a>. Neben 10 Hektar Weinbau besitzt die Winzerfamilie den ältesten verbrieften Weinkeller aus dem Jahr 1559. Runkels Sortiment umfasst auserlesene Rotweine in den Sorten Portugieser, Dornfelder, Spätburgunder, Merlot sowie ganz neu St. Laurent. Die Weißweine von den Rebsorten Chardonnay, Silvaner, Weißer Burgunder, Grauer Burgunder und Riesling sind geprägt von sortentypischen Fruchtaromen. Typische rheinhessische Rebsorten, z.B. Ortega und Gewürztraminer mit ihrer edlen Süße und vollen Aromen, ergänzen das Weinsortiment.<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/' addthis:title='Die Weincommunity wählt den besten Wein 2008 ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.jgeppert.com/2009/02/die-weincommunity-wahlt-den-besten-wein-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

