{"id":29983,"date":"2015-12-14T15:00:41","date_gmt":"2015-12-14T13:00:41","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=29983"},"modified":"2015-12-13T20:31:43","modified_gmt":"2015-12-13T18:31:43","slug":"jax-ws-annotations-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/","title":{"rendered":"JAX-WS Annotations Example"},"content":{"rendered":"<p>In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge required:<\/p>\n<ol>\n<li>Basic knowledge of how to use annotations<\/li>\n<li>Basic SOAP Architecture<\/li>\n<\/ol>\n<div class=\"toc\">\n<h3>Table Of Contents<\/h3>\n<dl>\n<dt><a href=\"#jaxws_annotations\">1. JAX-WS annotations<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#1_1\">1.1 @WebService<\/a><\/dt>\n<dt><a href=\"#1_2\">1.2 @SoapBinding<\/a><\/dt>\n<dt><a href=\"#1_3\">1.3 @WebMethod<\/a><\/dt>\n<dt><a href=\"#1_4\">1.4 @WebResult<\/a><\/dt>\n<dt><a href=\"#1_5\">1.5 @WebServiceClient<\/a><\/dt>\n<dt><a href=\"#1_6\">1.6 @RequestWrapper<\/a><\/dt>\n<dt><a href=\"#1_7\">1.7 @ResponseWrapper<\/a><\/dt>\n<dt><a href=\"#1_8\">1.8 @Oneway<\/a><\/dt>\n<dt><a href=\"#1_9\">1.9 @HandlerChain<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#dirStruct\">2. Directory structure of this example<\/a><\/dt>\n<dt><a href=\"#download\">3. Download the source code<\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"jaxws_annotations\"><\/a>1. JAX-WS annotations<\/h2>\n<h3><a name=\"1_1\"><\/a>1.1 @WebService<\/h3>\n<p>This JAX-WS annotation can be used in 2 ways. If we are annotating this over a class, it means that we are trying to mark the class as the implementing the Web Service, in other words Service Implementation Bean (SIB). Or we are marking this over an interface, it means that we are defining a Web Service Interface (SEI), in other words Service Endpoint Interface.<\/p>\n<p>Now lets see the java program demonstrating both of the mentioned ways:<\/p>\n<p><span style=\"text-decoration: underline\"><em>WSAnnotationWebServiceI.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.webservice;\r\n\r\nimport javax.jws.WebMethod;\r\nimport javax.jws.WebService;\r\nimport javax.jws.soap.SOAPBinding;\r\nimport javax.jws.soap.SOAPBinding.Style;\r\n\r\n@WebService\r\n@SOAPBinding(style=Style.RPC)\r\npublic interface WSAnnotationWebServiceI {\r\n\t@WebMethod\r\n\tfloat celsiusToFarhenheit(float celsius);\r\n}\r\n<\/pre>\n<p>In the above program we can see that we haven&#8217;t provided any optional element along with the <code>@WebService<\/code> annotation. And here it is used to define SEI. Regarding the other annotations used in the above program, we shall see their description a little ahead.<\/p>\n<p><span style=\"text-decoration: underline\"><em>WsAnnotationsWebServiceImpl.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.webservice;\r\n\r\nimport javax.jws.WebService;\r\n\r\n@WebService(endpointInterface=\"com.javacodegeeks.examples.jaxWsAnnotations.webservice.WSAnnotationWebServiceI\")\r\npublic class WsAnnotationsWebServiceImpl implements WSAnnotationWebServiceI {\r\n\t@Override\r\n\tpublic float celsiusToFarhenheit(float celsius) {\r\n\t\treturn ((celsius - 32)*5)\/9;\r\n\t}\r\n}\r\n<\/pre>\n<p>In the above program we can see that we have provided an optional element <code>endpointInterface<\/code> along with the <code>@WebService<\/code> annotation. And here it is used to define SIB. <code>endpointInterface<\/code> optional element describes the SEI that the said SIB is implementing.<\/p>\n<p>While implementing a web service as in above example, it is not mandatory for <code>WsAnnotationsWebServiceImpl<\/code> to implement <code>WSAnnotationWebServiceI<\/code>, this just serves as a check. Also, it is not mandatory to use an SEI, however, as a basic design principle &#8220;We should program to interface&#8221;, hence we have adapted this methodology in above program.<\/p>\n<p>Other optional elements to <code>@WebService<\/code> can be like <code>wsdlLocation<\/code> that defines location of pre-defined wsdl defining the web service, <code>name<\/code> that defines name of the web service etc.<\/p>\n<h3><a name=\"1_2\"><\/a>1.2 @SOAPBinding<\/h3>\n<p>Demonstration of <code>@SOAPBinding<\/code> JAX-WS annotation has already been shown in first program in <a href=\"#1_1\">1.1<\/a>. This annotation is used to specify the SOAP messaging <code>style<\/code> which can either be <code>RPC<\/code> or <code>DOCUMENT<\/code>. This style represents the encoding style of message sent to and fro while using the web service.<\/p>\n<p>With <code>RPC<\/code> style a web service is capable of only using simple data types like integer or string. However, <code>DOCUMENT<\/code> style is capable of richer data types for a class let&#8217;s say Person, which can have attributes like <code>String name<\/code>, <code>Address address<\/code> etc.<\/p>\n<p><code>Document<\/code> style indicates that in the underlying web service, underlying message shall contain full XML documents, whereas in the <code>RPC<\/code> style, the underlying message contains parameters and return values in request and response message respectively. By default the <code>style<\/code> is <code>Document<\/code>.<\/p>\n<p>The other important optional attribute is <code>use<\/code>. It represents the formatting style of the web service message. Its value can either be <code>literal<\/code> or <code>encoded<\/code>.<\/p>\n<p>Example usage of @SOAPBinding:<\/p>\n<p><code>@SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL)<\/code><\/p>\n<h3><a name=\"1_3\"><\/a>1.3 @WebMethod<\/h3>\n<p><code>@WebMethod<\/code> JAX-WS annotation can be applied over a method only. This specified that the method represents a web service operation. For its demonstration, please refer to first program in <a href=\"#1_1\">1.1<\/a>.<\/p>\n<h3><a name=\"1_4\"><\/a>1.4 @WebResult<\/h3>\n<p>To understand this JAX-WS annotation, let&#8217;s write SEI &amp; SIB again:<\/p>\n<p><span style=\"text-decoration: underline\"><em>WSAnnotationsWebResultI.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.webresult;\r\n\r\nimport javax.jws.WebMethod;\r\nimport javax.jws.WebResult;\r\nimport javax.jws.WebService;\r\nimport javax.jws.soap.SOAPBinding;\r\nimport javax.jws.soap.SOAPBinding.Style;\r\n\r\n@WebService\r\n@SOAPBinding(style = Style.RPC)\r\npublic interface WSAnnotationsWebResultI {\r\n\t@WebMethod\r\n\t@WebResult(partName=\"farhenheitResponse\")\r\n\tfloat celsiusToFarhenheit(float celsius);\r\n}\r\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>WSAnnotationsWebResultImpl.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.webresult;\r\n\r\nimport javax.jws.WebService;\r\n\r\n@WebService(endpointInterface=\"com.javacodegeeks.examples.jaxWsAnnotations.webresult.WSAnnotationsWebResultI\")\r\npublic class WSAnnotationsWebResultImpl implements WSAnnotationsWebResultI {\r\n\t@Override\r\n\tpublic float celsiusToFarhenheit(float celsius) {\r\n\t\treturn ((celsius - 32)*5)\/9;\r\n\t}\r\n}\r\n<\/pre>\n<p>Now let&#8217;s publish this endpoint:<\/p>\n<p><span style=\"text-decoration: underline\"><em>WSPublisher.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.webresult;\r\n\r\nimport javax.xml.ws.Endpoint;\r\n\r\npublic class WSPublisher {\r\n\tpublic static void main(String[] args) {\r\n\t\tEndpoint.publish(\"http:\/\/127.0.0.1:9999\/ctf\", new WSAnnotationsWebResultImpl());\r\n\t}\r\n}\r\n<\/pre>\n<p>On publishing the generated WSDL (at URL: <code>http:\/\/127.0.0.1:9999\/ctf?wsdl<\/code>) would be like:<\/p>\n<pre class=\"brush:xml; highlight:[14];wrap-lines:false\">\r\n&lt;definitions\r\n\txmlns:wsu=\"http:\/\/docs.oasis-open.org\/wss\/2004\/01\/oasis-200401-wss-wssecurity-utility-1.0.xsd\"\r\n\txmlns:wsp=\"http:\/\/www.w3.org\/ns\/ws-policy\" xmlns:wsp1_2=\"http:\/\/schemas.xmlsoap.org\/ws\/2004\/09\/policy\"\r\n\txmlns:wsam=\"http:\/\/www.w3.org\/2007\/05\/addressing\/metadata\" xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/wsdl\/soap\/\"\r\n\txmlns:tns=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\"\r\n\txmlns:xsd=\"http:\/\/www.w3.org\/2001\/XMLSchema\" xmlns=\"http:\/\/schemas.xmlsoap.org\/wsdl\/\"\r\n\ttargetNamespace=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\"\r\n\tname=\"WSAnnotationsWebResultImplService\"&gt;\r\n\t&lt;types \/&gt;\r\n\t&lt;message name=\"celsiusToFarhenheit\"&gt;\r\n\t\t&lt;part name=\"arg0\" type=\"xsd:float\" \/&gt;\r\n\t&lt;\/message&gt;\r\n\t&lt;message name=\"celsiusToFarhenheitResponse\"&gt;\r\n\t\t&lt;part name=\"farhenheitResponse\" type=\"xsd:float\" \/&gt;\r\n\t&lt;\/message&gt;\r\n\t&lt;portType name=\"WSAnnotationsWebResultI\"&gt;\r\n\t\t&lt;operation name=\"celsiusToFarhenheit\"&gt;\r\n\t\t\t&lt;input\r\n\t\t\t\twsam:Action=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/WSAnnotationsWebResultI\/celsiusToFarhenheitRequest\"\r\n\t\t\t\tmessage=\"tns:celsiusToFarhenheit\" \/&gt;\r\n\t\t\t&lt;output\r\n\t\t\t\twsam:Action=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/WSAnnotationsWebResultI\/celsiusToFarhenheitResponse\"\r\n\t\t\t\tmessage=\"tns:celsiusToFarhenheitResponse\" \/&gt;\r\n\t\t&lt;\/operation&gt;\r\n\t&lt;\/portType&gt;\r\n\t&lt;binding name=\"WSAnnotationsWebResultImplPortBinding\" type=\"tns:WSAnnotationsWebResultI\"&gt;\r\n\t\t&lt;soap:binding transport=\"http:\/\/schemas.xmlsoap.org\/soap\/http\"\r\n\t\t\tstyle=\"rpc\" \/&gt;\r\n\t\t&lt;operation name=\"celsiusToFarhenheit\"&gt;\r\n\t\t\t&lt;soap:operation soapAction=\"\" \/&gt;\r\n\t\t\t&lt;input&gt;\r\n\t\t\t\t&lt;soap:body use=\"literal\"\r\n\t\t\t\t\tnamespace=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\" \/&gt;\r\n\t\t\t&lt;\/input&gt;\r\n\t\t\t&lt;output&gt;\r\n\t\t\t\t&lt;soap:body use=\"literal\"\r\n\t\t\t\t\tnamespace=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\" \/&gt;\r\n\t\t\t&lt;\/output&gt;\r\n\t\t&lt;\/operation&gt;\r\n\t&lt;\/binding&gt;\r\n\t&lt;service name=\"WSAnnotationsWebResultImplService\"&gt;\r\n\t\t&lt;port name=\"WSAnnotationsWebResultImplPort\" binding=\"tns:WSAnnotationsWebResultImplPortBinding\"&gt;\r\n\t\t\t&lt;soap:address location=\"http:\/\/127.0.0.1:9999\/ctf\" \/&gt;\r\n\t\t&lt;\/port&gt;\r\n\t&lt;\/service&gt;\r\n&lt;\/definitions&gt;\r\n<\/pre>\n<p>Refer to the highlighted line in above wsdl, the <code>part name<\/code> has been changed to &#8220;<code>farhenheitResponse<\/code>&#8221; as was defined using <code>@WebResult<\/code>. What interest here is that <code>@WebResult<\/code> can be used to determine what the generated WSDL shall look like.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>If we comment out the <code>@WebResult<\/code>, the WSDL (at URL: <code>http:\/\/127.0.0.1:9999\/ctf?wsdl<\/code>) shall be like:<\/p>\n<pre class=\"brush:xml; highlight:[14];wrap-lines:false\">\r\n&lt;definitions\r\n\txmlns:wsu=\"http:\/\/docs.oasis-open.org\/wss\/2004\/01\/oasis-200401-wss-wssecurity-utility-1.0.xsd\"\r\n\txmlns:wsp=\"http:\/\/www.w3.org\/ns\/ws-policy\" xmlns:wsp1_2=\"http:\/\/schemas.xmlsoap.org\/ws\/2004\/09\/policy\"\r\n\txmlns:wsam=\"http:\/\/www.w3.org\/2007\/05\/addressing\/metadata\" xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/wsdl\/soap\/\"\r\n\txmlns:tns=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\"\r\n\txmlns:xsd=\"http:\/\/www.w3.org\/2001\/XMLSchema\" xmlns=\"http:\/\/schemas.xmlsoap.org\/wsdl\/\"\r\n\ttargetNamespace=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\"\r\n\tname=\"WSAnnotationsWebResultImplService\"&gt;\r\n\t&lt;types \/&gt;\r\n\t&lt;message name=\"celsiusToFarhenheit\"&gt;\r\n\t\t&lt;part name=\"arg0\" type=\"xsd:float\" \/&gt;\r\n\t&lt;\/message&gt;\r\n\t&lt;message name=\"celsiusToFarhenheitResponse\"&gt;\r\n\t\t&lt;part name=\"return\" type=\"xsd:float\" \/&gt;\r\n\t&lt;\/message&gt;\r\n\t&lt;portType name=\"WSAnnotationsWebResultI\"&gt;\r\n\t\t&lt;operation name=\"celsiusToFarhenheit\"&gt;\r\n\t\t\t&lt;input\r\n\t\t\t\twsam:Action=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/WSAnnotationsWebResultI\/celsiusToFarhenheitRequest\"\r\n\t\t\t\tmessage=\"tns:celsiusToFarhenheit\" \/&gt;\r\n\t\t\t&lt;output\r\n\t\t\t\twsam:Action=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/WSAnnotationsWebResultI\/celsiusToFarhenheitResponse\"\r\n\t\t\t\tmessage=\"tns:celsiusToFarhenheitResponse\" \/&gt;\r\n\t\t&lt;\/operation&gt;\r\n\t&lt;\/portType&gt;\r\n\t&lt;binding name=\"WSAnnotationsWebResultImplPortBinding\" type=\"tns:WSAnnotationsWebResultI\"&gt;\r\n\t\t&lt;soap:binding transport=\"http:\/\/schemas.xmlsoap.org\/soap\/http\"\r\n\t\t\tstyle=\"rpc\" \/&gt;\r\n\t\t&lt;operation name=\"celsiusToFarhenheit\"&gt;\r\n\t\t\t&lt;soap:operation soapAction=\"\" \/&gt;\r\n\t\t\t&lt;input&gt;\r\n\t\t\t\t&lt;soap:body use=\"literal\"\r\n\t\t\t\t\tnamespace=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\" \/&gt;\r\n\t\t\t&lt;\/input&gt;\r\n\t\t\t&lt;output&gt;\r\n\t\t\t\t&lt;soap:body use=\"literal\"\r\n\t\t\t\t\tnamespace=\"http:\/\/webresult.jaxWsAnnotations.examples.javacodegeeks.com\/\" \/&gt;\r\n\t\t\t&lt;\/output&gt;\r\n\t\t&lt;\/operation&gt;\r\n\t&lt;\/binding&gt;\r\n\t&lt;service name=\"WSAnnotationsWebResultImplService\"&gt;\r\n\t\t&lt;port name=\"WSAnnotationsWebResultImplPort\" binding=\"tns:WSAnnotationsWebResultImplPortBinding\"&gt;\r\n\t\t\t&lt;soap:address location=\"http:\/\/127.0.0.1:9999\/ctf\" \/&gt;\r\n\t\t&lt;\/port&gt;\r\n\t&lt;\/service&gt;\r\n&lt;\/definitions&gt;\r\n<\/pre>\n<p>In the above program, <code>part name<\/code> has value <code>return<\/code>.<\/p>\n<p>Other elements to <code>@WebResult<\/code> are <code>WebParam.Mode<\/code> that defines the direction in which parameter is flowing, <code>targetNamespace<\/code> to define XML namespace for the parameter.<\/p>\n<h3><a name=\"1_5\"><\/a>1.5 @WebServiceClient<\/h3>\n<p>To understand @WebServiceClient JAX-WS annotation, let us first publish the endpoint written in <a href=\"#1_1\">1.1<\/a> using below program:<\/p>\n<p><span style=\"text-decoration: underline\"><em>WSPublisher.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.webservice;\r\n\r\nimport javax.xml.ws.Endpoint;\r\n\r\npublic class WSPublisher {\r\n\tpublic static void main(String[] args) {\r\n\t\tEndpoint.publish(\"http:\/\/127.0.0.1:9999\/ctf\", new WsAnnotationsWebServiceImpl());\r\n\t}\r\n}\r\n<\/pre>\n<p>Before moving further we should understand <code>wsimport<\/code> utility provided by Java that eases the task of writing client for a SOAP based web service. We won&#8217;t go into much detail here about <code>wsimport<\/code>, instead let&#8217;s first save the wsdl file with name &#8216;ctf.wsdl&#8217; and then write following command on the command prompt:<\/p>\n<p><code>wsimport -keep -p client ctf.wsdl<\/code><\/p>\n<p>The generated code shall have following classes generated:<br \/>\n<figure id=\"attachment_30258\" aria-describedby=\"caption-attachment-30258\" style=\"width: 557px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/clientFiles.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/clientFiles.jpg\" alt=\"Client files generated\" width=\"557\" height=\"226\" class=\"size-full wp-image-30258\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/clientFiles.jpg 557w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/clientFiles-300x122.jpg 300w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><\/a><figcaption id=\"caption-attachment-30258\" class=\"wp-caption-text\">Client files generated<\/figcaption><\/figure><\/p>\n<p>Now let&#8217;s open <code>WsAnnotationsWebServiceImplService.java<\/code>. It shall be like:<\/p>\n<p><span style=\"text-decoration: underline\"><em>WsAnnotationsWebServiceImplService.java<\/em><\/span><\/p>\n<pre class=\"brush:java; highlight:[17]\">\r\npackage client;\r\n\r\nimport java.net.MalformedURLException;\r\nimport java.net.URL;\r\nimport javax.xml.namespace.QName;\r\nimport javax.xml.ws.Service;\r\nimport javax.xml.ws.WebEndpoint;\r\nimport javax.xml.ws.WebServiceClient;\r\nimport javax.xml.ws.WebServiceException;\r\nimport javax.xml.ws.WebServiceFeature;\r\n\r\n\/**\r\n * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b130926.1035\r\n * Generated source version: 2.2\r\n * \r\n *\/\r\n@WebServiceClient(name = \"WsAnnotationsWebServiceImplService\", targetNamespace = \"http:\/\/webservice.jaxWsAnnotations.examples.javacodegeeks.com\/\", wsdlLocation = \"file:\/Users\/saurabharora123\/Downloads\/ctf.wsdl\")\r\npublic class WsAnnotationsWebServiceImplService extends Service {\r\n\r\n\tprivate final static URL WSANNOTATIONSWEBSERVICEIMPLSERVICE_WSDL_LOCATION;\r\n\tprivate final static WebServiceException WSANNOTATIONSWEBSERVICEIMPLSERVICE_EXCEPTION;\r\n\tprivate final static QName WSANNOTATIONSWEBSERVICEIMPLSERVICE_QNAME = new QName(\r\n\t\t\t\"http:\/\/webservice.jaxWsAnnotations.examples.javacodegeeks.com\/\", \"WsAnnotationsWebServiceImplService\");\r\n\r\n\tstatic {\r\n\t\tURL url = null;\r\n\t\tWebServiceException e = null;\r\n\t\ttry {\r\n\t\t\turl = new URL(\"file:\/Users\/saurabharora123\/Downloads\/ctf.wsdl\");\r\n\t\t} catch (MalformedURLException ex) {\r\n\t\t\te = new WebServiceException(ex);\r\n\t\t}\r\n\t\tWSANNOTATIONSWEBSERVICEIMPLSERVICE_WSDL_LOCATION = url;\r\n\t\tWSANNOTATIONSWEBSERVICEIMPLSERVICE_EXCEPTION = e;\r\n\t}\r\n\r\n\tpublic WsAnnotationsWebServiceImplService() {\r\n\t\tsuper(__getWsdlLocation(), WSANNOTATIONSWEBSERVICEIMPLSERVICE_QNAME);\r\n\t}\r\n\r\n\tpublic WsAnnotationsWebServiceImplService(WebServiceFeature... features) {\r\n\t\tsuper(__getWsdlLocation(), WSANNOTATIONSWEBSERVICEIMPLSERVICE_QNAME, features);\r\n\t}\r\n\r\n\tpublic WsAnnotationsWebServiceImplService(URL wsdlLocation) {\r\n\t\tsuper(wsdlLocation, WSANNOTATIONSWEBSERVICEIMPLSERVICE_QNAME);\r\n\t}\r\n\r\n\tpublic WsAnnotationsWebServiceImplService(URL wsdlLocation, WebServiceFeature... features) {\r\n\t\tsuper(wsdlLocation, WSANNOTATIONSWEBSERVICEIMPLSERVICE_QNAME, features);\r\n\t}\r\n\r\n\tpublic WsAnnotationsWebServiceImplService(URL wsdlLocation, QName serviceName) {\r\n\t\tsuper(wsdlLocation, serviceName);\r\n\t}\r\n\r\n\tpublic WsAnnotationsWebServiceImplService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {\r\n\t\tsuper(wsdlLocation, serviceName, features);\r\n\t}\r\n\r\n\t\/**\r\n\t * \r\n\t * @return returns WSAnnotationWebServiceI\r\n\t *\/\r\n\t@WebEndpoint(name = \"WsAnnotationsWebServiceImplPort\")\r\n\tpublic WSAnnotationWebServiceI getWsAnnotationsWebServiceImplPort() {\r\n\t\treturn super.getPort(new QName(\"http:\/\/webservice.jaxWsAnnotations.examples.javacodegeeks.com\/\",\r\n\t\t\t\t\"WsAnnotationsWebServiceImplPort\"), WSAnnotationWebServiceI.class);\r\n\t}\r\n\r\n\t\/**\r\n\t * \r\n\t * @param features\r\n\t *            A list of {@link javax.xml.ws.WebServiceFeature} to configure\r\n\t *            on the proxy. Supported features not in the\r\n\t *            <code>features<\/code> parameter will have their default\r\n\t *            values.\r\n\t * @return returns WSAnnotationWebServiceI\r\n\t *\/\r\n\t@WebEndpoint(name = \"WsAnnotationsWebServiceImplPort\")\r\n\tpublic WSAnnotationWebServiceI getWsAnnotationsWebServiceImplPort(WebServiceFeature... features) {\r\n\t\treturn super.getPort(new QName(\"http:\/\/webservice.jaxWsAnnotations.examples.javacodegeeks.com\/\",\r\n\t\t\t\t\"WsAnnotationsWebServiceImplPort\"), WSAnnotationWebServiceI.class, features);\r\n\t}\r\n\r\n\tprivate static URL __getWsdlLocation() {\r\n\t\tif (WSANNOTATIONSWEBSERVICEIMPLSERVICE_EXCEPTION != null) {\r\n\t\t\tthrow WSANNOTATIONSWEBSERVICEIMPLSERVICE_EXCEPTION;\r\n\t\t}\r\n\t\treturn WSANNOTATIONSWEBSERVICEIMPLSERVICE_WSDL_LOCATION;\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>Refer to the highlighted line in the above generated program that has the annotation <code>@WebServiceClient<\/code>. The information specified in this annotation helps in identifying a wsdl:service element inside a WSDL document. This element represents the Web service for which the generated service interface provides a client view.<\/p>\n<h3><a name=\"1_6\"><\/a>1.6 @RequestWrapper<\/h3>\n<p><code>@RequestWrapper<\/code> JAX-WS annotation is used to annotate methods in the Service Endpoint Interface with the request wrapper bean to be used at runtime. It has 4 optional elements; <code>className<\/code> that represents the request wrapper bean name, <code>localName<\/code> that represents element&#8217;s local name, <code>partName<\/code> that represent the part name of the wrapper part in the generated WSDL file, and <code>targetNamespace<\/code> that represents the element&#8217;s namespace.<\/p>\n<p>Example usage: <span style=\"text-decoration: underline\"><em>WSRequestWrapperInterface.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.wrapper;\r\n\r\nimport javax.jws.WebMethod;\r\nimport javax.jws.WebService;\r\nimport javax.jws.soap.SOAPBinding;\r\nimport javax.jws.soap.SOAPBinding.Style;\r\nimport javax.xml.ws.RequestWrapper;\r\n\r\n@WebService\r\n@SOAPBinding(style=Style.RPC)\r\npublic interface WSRequestWrapperInterface {\r\n\t@WebMethod\r\n\t@RequestWrapper(localName=\"CTF\", \r\n\ttargetNamespace=\"http:\/\/javacodegeeks.com\/tempUtil\", \r\n\tclassName=\"com.javacodegeeks.examples.jaxWsAnnotations.webservice.CTF\")\r\n\tfloat celsiusToFarhenheit(float celsius);\r\n}\r\n<\/pre>\n<h3><a name=\"1_7\"><\/a>1.7 @ResponseWrapper<\/h3>\n<p><code>@ResponseWrapper<\/code> JAX-WS annotation is used to annotate methods in the Service Endpoint Interface with the response wrapper bean to be used at runtime. It has 4 optional elements; <code>className<\/code> that represents the response wrapper bean name, <code>localName<\/code> that represents element&#8217;s local name, <code>partName<\/code> that represent the part name of the wrapper part in the generated WSDL file, and <code>targetNamespace<\/code> that represents the element&#8217;s namespace.<\/p>\n<p>Example usage: <span style=\"text-decoration: underline\"><em>WSRequestWrapperInterface.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.wrapper;\r\n\r\nimport javax.jws.WebMethod;\r\nimport javax.xml.ws.ResponseWrapper;\r\n\r\npublic interface WSResponseWrapperInterfaceI {\r\n\t@WebMethod\r\n\t@ResponseWrapper(localName=\"CTFResponse\", \r\n\ttargetNamespace=\"http:\/\/javacodegeeks.com\/tempUtil\", \r\n\tclassName=\"com.javacodegeeks.examples.jaxWsAnnotations.webservice.CTFResponse\")\r\n\tfloat celsiusToFarhenheit(float celsius);\r\n}\r\n<\/pre>\n<h3><a name=\"1_8\"><\/a>1.8 @Oneway<\/h3>\n<p><code>@Oneway<\/code> JAX-WS annotation is applied to WebMethod which means that method will have only input and no output. When a <code>@Oneway<\/code> method is called, control is returned to calling method even before the actual operation is performed. It means that nothing will escape method neither response neither exception.<\/p>\n<p>Example usage: <span style=\"text-decoration: underline\"><em>WSAnnotationsOnewayI.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.oneway;\r\n\r\nimport javax.jws.Oneway;\r\nimport javax.jws.WebMethod;\r\nimport javax.jws.WebService;\r\nimport javax.jws.soap.SOAPBinding;\r\nimport javax.jws.soap.SOAPBinding.Style;\r\n\r\n@WebService\r\n@SOAPBinding(style = Style.RPC)\r\npublic interface WSAnnotationsOnewayI {\r\n\t@WebMethod\r\n\t@Oneway\r\n\tvoid sayHello();\r\n}\r\n<\/pre>\n<h3><a name=\"1_9\"><\/a>1.9 @HandlerChain<\/h3>\n<p>Web Services and their clients may need to access the SOAP message for additional processing of the message request or response. A SOAP message handler provides a mechanism for intercepting the SOAP message during request and response.<\/p>\n<p>A handler at server side can be a validator. Let&#8217;s say we want to validate the temperature before the actual service method is called. To do this our validator class shall implement interface <code>SOAPHandler<\/code><\/p>\n<p><span style=\"text-decoration: underline\"><em>TemperatureValidator.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.handler;\r\n\r\nimport java.util.Set;\r\n\r\nimport javax.xml.namespace.QName;\r\nimport javax.xml.ws.handler.MessageContext;\r\nimport javax.xml.ws.handler.soap.SOAPHandler;\r\nimport javax.xml.ws.handler.soap.SOAPMessageContext;\r\n\r\npublic class TemperatureValidator implements SOAPHandler {\r\n\r\n\t@Override\r\n\tpublic boolean handleMessage(SOAPMessageContext context) {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\treturn false;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic boolean handleFault(SOAPMessageContext context) {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\treturn false;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void close(MessageContext context) {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\t\r\n\t}\r\n\r\n\t@Override\r\n\tpublic Set getHeaders() {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\treturn null;\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>Next we shall implement SOAP handler xml file that may also contain sequence of handlers.<\/p>\n<p><span style=\"text-decoration: underline\"><em>soap-handler.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">\r\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?&gt;\r\n&lt;javaee:handler-chains xmlns:javaee=\"http:\/\/java.sun.com\/xml\/ns\/javaee\"\r\n\txmlns:xsd=\"http:\/\/www.w3.org\/2001\/XMLSchema\"&gt;\r\n\t&lt;javaee:handler-chain&gt;\r\n\t\t&lt;javaee:handler&gt;\r\n\t\t\t&lt;javaee:handler-class&gt;com.javacodegeeks.examples.jaxWsAnnotations.handler.TemperatureValidator\r\n\t\t\t&lt;\/javaee:handler-class&gt;\r\n\t\t&lt;\/javaee:handler&gt;\r\n\t&lt;\/javaee:handler-chain&gt;\r\n&lt;\/javaee:handler-chains&gt;\r\n<\/pre>\n<p>After this we shall configure <code>@HandlerChain<\/code> JAX-WS annotation in SEI:<\/p>\n<p><span style=\"text-decoration: underline\"><em>WSAnnotationsHandlerChainI.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.examples.jaxWsAnnotations.handler;\r\n\r\nimport javax.jws.HandlerChain;\r\nimport javax.jws.WebMethod;\r\nimport javax.jws.WebService;\r\nimport javax.jws.soap.SOAPBinding;\r\nimport javax.jws.soap.SOAPBinding.Style;\r\n\r\n@WebService\r\n@SOAPBinding(style = Style.RPC)\r\npublic interface WSAnnotationsHandlerChainI {\r\n\t@HandlerChain(file = \"soap-handler.xml\")\r\n\t@WebMethod\r\n\tfloat celsiusToFarhenheit(float celsius);\r\n}\r\n<\/pre>\n<h2><a name=\"dirStruct\"><\/a>2. Directory structure of this example<\/h2>\n<p>The directory structure of the above example in eclipse shall look like:<\/p>\n<p><figure id=\"attachment_30256\" aria-describedby=\"caption-attachment-30256\" style=\"width: 391px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/DirStruct.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/DirStruct.jpg\" alt=\"Directory Structure\" width=\"391\" height=\"534\" class=\"size-full wp-image-30256\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/DirStruct.jpg 391w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/DirStruct-220x300.jpg 220w\" sizes=\"(max-width: 391px) 100vw, 391px\" \/><\/a><figcaption id=\"caption-attachment-30256\" class=\"wp-caption-text\">Directory Structure<\/figcaption><\/figure><\/p>\n<h2><a name=\"download\"><\/a>3. Download the source code<\/h2>\n<p>This was an example of JAX-WS annotations.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/JaxWSAnnotationsExample.zip\"><strong>JaxWSAnnotationsExample<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge required: Basic knowledge of how to use annotations Basic SOAP Architecture Table Of Contents 1. JAX-WS annotations 1.1 @WebService 1.2 @SoapBinding 1.3 @WebMethod 1.4 @WebResult 1.5 @WebServiceClient 1.6 @RequestWrapper 1.7 @ResponseWrapper 1.8 @Oneway &hellip;<\/p>\n","protected":false},"author":75,"featured_media":1240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[461],"tags":[484,1288,1264,1280,1287,1285,1286,467,1281,852,1282,1283,1284],"class_list":["post-29983","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jws","tag-annotation","tag-handlerchain","tag-jax-ws","tag-jaxws","tag-oneway","tag-requestwrapper","tag-responsewrapper","tag-soap","tag-soapbinding","tag-web-service","tag-webmethod","tag-webresult","tag-webserviceclient"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JAX-WS Annotations Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JAX-WS Annotations Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-14T13:00:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Saurabh Arora\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Saurabh Arora\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\"},\"author\":{\"name\":\"Saurabh Arora\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c\"},\"headline\":\"JAX-WS Annotations Example\",\"datePublished\":\"2015-12-14T13:00:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\"},\"wordCount\":1060,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"keywords\":[\"Annotation\",\"handlerchain\",\"JAX-WS\",\"jaxws\",\"oneway\",\"requestwrapper\",\"responsewrapper\",\"SOAP\",\"soapbinding\",\"web service\",\"webmethod\",\"webresult\",\"webserviceclient\"],\"articleSection\":[\"jws\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\",\"name\":\"JAX-WS Annotations Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"datePublished\":\"2015-12-14T13:00:41+00:00\",\"description\":\"In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jws\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jws\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JAX-WS Annotations Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c\",\"name\":\"Saurabh Arora\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg\",\"caption\":\"Saurabh Arora\"},\"description\":\"Saurabh graduated with an engineering degree in Information Technology from YMCA Institute of Engineering, India. He is SCJP, OCWCD certified and currently working as Technical Lead with one of the biggest service based firms and is involved in projects extensively using Java and JEE technologies. He has worked in E-Commerce, Banking and Telecom domain.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/in.linkedin.com\/in\/saurabh-arora-78674b18\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/saurabh-arora\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JAX-WS Annotations Example - Java Code Geeks","description":"In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/","og_locale":"en_US","og_type":"article","og_title":"JAX-WS Annotations Example - Java Code Geeks","og_description":"In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-12-14T13:00:41+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Saurabh Arora","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Saurabh Arora","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/"},"author":{"name":"Saurabh Arora","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c"},"headline":"JAX-WS Annotations Example","datePublished":"2015-12-14T13:00:41+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/"},"wordCount":1060,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","keywords":["Annotation","handlerchain","JAX-WS","jaxws","oneway","requestwrapper","responsewrapper","SOAP","soapbinding","web service","webmethod","webresult","webserviceclient"],"articleSection":["jws"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/","name":"JAX-WS Annotations Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","datePublished":"2015-12-14T13:00:41+00:00","description":"In this example we shall learn some important JAX-WS annotations provided by Java. To understand this tutorial, following is the prerequisite knowledge","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jws\/jax-ws-annotations-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"jws","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jws\/"},{"@type":"ListItem","position":5,"name":"JAX-WS Annotations Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5bf4e0274824642c44536b83ddbfaf6c","name":"Saurabh Arora","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/11\/Saurabh-Arora-96x96.jpg","caption":"Saurabh Arora"},"description":"Saurabh graduated with an engineering degree in Information Technology from YMCA Institute of Engineering, India. He is SCJP, OCWCD certified and currently working as Technical Lead with one of the biggest service based firms and is involved in projects extensively using Java and JEE technologies. He has worked in E-Commerce, Banking and Telecom domain.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/in.linkedin.com\/in\/saurabh-arora-78674b18"],"url":"https:\/\/examples.javacodegeeks.com\/author\/saurabh-arora\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/29983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=29983"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/29983\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1240"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=29983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=29983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=29983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}