<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Jsr224 on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/jsr224/</link>
    <description>Recent content in Jsr224 on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #e9d956c0c0154a221ad83c925346a8fa0e72f866</copyright>
    <lastBuildDate>Thu, 23 Sep 2010 00:00:00 +0200</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/jsr224/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Creating a SOAP Service using JAX-WS Annotations</title>
      <link>https://www.hascode.com/creating-a-soap-service-using-jax-ws-annotations/</link>
      <pubDate>Thu, 23 Sep 2010 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/creating-a-soap-service-using-jax-ws-annotations/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;It is possible to create SOAP webservices with only a few lines of code using the JAX-WS annotations. In a productivity environment you might prefer using &lt;em&gt;contract-first&lt;/em&gt; instead of &lt;em&gt;code-first&lt;/em&gt; to create your webservice but for now we’re going to use the fast method and that means &lt;em&gt;code-first&lt;/em&gt; and annotations olé!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_creating_the_soap_service&#34;&gt;Creating the SOAP Service&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Create a class &lt;em&gt;SampleService&lt;/em&gt; with two public methods&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Annotate this class with &lt;em&gt;@WebService&lt;/em&gt; (&lt;em&gt;javax.jws.WebService) –&lt;/em&gt; now all public methods of this class are exported for our SOAP service&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To change the name of an exported method, annotate the method with &lt;em&gt;@WebMethod(operationName = “theDesiredName”)&lt;/em&gt; (&lt;em&gt;javax.jws.WebMethod&lt;/em&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally the service class could look like this&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;package com.hascode.tutorial.soap;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService public class SampleService {
 @WebMethod(operationName = &amp;#34;getInfo&amp;#34;) public String getInformation() {
 return &amp;#34;hasCode.com&amp;#34;;
 }

 public String doubleString(String inString) {
 return inString + inString;
 }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
