blob: 608e594be9aa656119fec9803542ac3fa62ff933 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<link type="text/css" rel="stylesheet" href="/resources/site.css">
<script src='/resources/space.js'></script>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="keywords" content="business integration, EAI, SOA, Service Oriented Architecture, web services, SOAP, JBI, JMS, WSDL, XML, EDI, Electronic Data Interchange, standards support, integration standards, application integration, middleware, software, solutions, services, CXF, open source">
<meta name="description" content="Apache CXF, Services Framework - JAX-WS Configuration">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shCoreCXF.css">
<link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
<script src='/resources/highlighter/scripts/shCore.js'></script>
<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- JAX-WS Configuration
</title>
</head>
<body onload="init()">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td id="cell-0-0" colspan="2">&nbsp;</td>
<td id="cell-0-1">&nbsp;</td>
<td id="cell-0-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-1-0">&nbsp;</td>
<td id="cell-1-1">&nbsp;</td>
<td id="cell-1-2">
<!-- Banner -->
<div class="banner" id="banner"><div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
<a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
</td><td align="right" colspan="1" nowrap>
<a shape="rect" href="http://www.apache.org/" title="The Apache Sofware Foundation"><img border="0" alt="ASF Logo" src="http://cxf.apache.org/images/asf-logo.png"></a>
</td></tr></table></div></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>
<div align="left">
<!-- Breadcrumbs -->
<a href="index.html">Index</a>&nbsp;&gt;&nbsp;<a href="frontends.html">Frontends</a>&nbsp;&gt;&nbsp;<a href="jax-ws.html">JAX-WS</a>&nbsp;&gt;&nbsp;<a href="jax-ws-configuration.html">JAX-WS Configuration</a>
<!-- Breadcrumbs -->
</div>
</td>
<td>
<div align="right">
<!-- Quicklinks -->
<div id="quicklinks"><p><a shape="rect" href="http://cxf.apache.org/download.html">Download</a> | <a shape="rect" href="http://cxf.apache.org/docs/index.html">Documentation</a></p></div>
<!-- Quicklinks -->
</div>
</td>
</tr>
</table>
</div>
</td>
<td id="cell-1-3">&nbsp;</td>
<td id="cell-1-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-2-0" colspan="2">&nbsp;</td>
<td id="cell-2-1">
<table>
<tr valign="top">
<td height="100%">
<div id="wrapper-menu-page-right">
<div id="wrapper-menu-page-top">
<div id="wrapper-menu-page-bottom">
<div id="menu-page">
<!-- NavigationBar -->
<div id="navigation"><ul class="alternate"><li><a shape="rect" href="overview.html">Overview</a></li><li><a shape="rect" href="how-tos.html">How-Tos</a></li><li><a shape="rect" href="frontends.html">Frontends</a></li><li><a shape="rect" href="databindings.html">DataBindings</a></li><li><a shape="rect" href="transports.html">Transports</a></li><li><a shape="rect" href="configuration.html">Configuration</a></li><li><a shape="rect" href="debugging-and-logging.html">Debugging and Logging</a></li><li><a shape="rect" href="tools.html">Tools</a></li><li><a shape="rect" href="restful-services.html">RESTful Services</a></li><li><a shape="rect" href="wsdl-bindings.html">WSDL Bindings</a></li><li><a shape="rect" href="service-routing.html">Service Routing</a></li><li><a shape="rect" href="dynamic-languages.html">Dynamic Languages</a></li><li><a shape="rect" href="ws-support.html">WS-* Support</a></li><li><a shape="rect" href="advanced-integration.html">Advanced Integration</a></li><li><a shape="rect" href="deployment.html">Deployment</a></li><li><a shape="rect" href="schemas-and-namespaces.html">Use of Schemas and Namespaces</a></li></ul><hr><ul class="alternate"><li><p>Search</p></li></ul><form enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box" action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="002890367768291051730:o99qiwa09y4">
<input type="hidden" name="ie" value="UTF-8">
<input type="text" name="q" size="21">
<input type="submit" name="sa" value="Search">
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script><hr><ul class="alternate"><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest/">API 3.2.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/javadoc/latest-3.1.x/">API 3.1.x (Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF Website</a></li></ul><p>&#160;</p><p><a shape="rect" class="external-link" href="http://www.apache.org/events/current-event.html"><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.apache.org/events/current-event-125x125.png" data-image-src="http://www.apache.org/events/current-event-125x125.png"></span></a></p></div>
<!-- NavigationBar -->
</div>
</div>
</div>
</div>
</td>
<td height="100%">
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p>Please see the <a shape="rect" href="configuration.html">Configuration</a> section to learn how to supply a configuration to CXF. The following sections include just JAX-WS specific configuration items.</p><h1 id="JAXWSConfiguration-ConfiguringanEndpoint">Configuring an Endpoint</h1><p>A JAX-WS Endpoint can be configured in XML in addition to using the JAX-WS APIs. Once you've created your <a shape="rect" href="developing-a-service.html">server implementation</a>, you simply need to provide the class name and an address. Here is a simple example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"&gt;
&lt;jaxws:endpoint id="classImpl"
implementor="org.apache.cxf.jaxws.service.Hello"
endpointName="e:HelloEndpointCustomized"
serviceName="s:HelloServiceCustomized"
address="http://localhost:8080/test"
xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
xmlns:s="http://service.jaxws.cxf.apache.org/service"/&gt;
&lt;/beans&gt;
</pre>
</div></div><p>Be sure to include the JAX-WS <code>schemaLocation</code> attribute specified on the root beans element. This allows CXF to validate the file and is required. Also note the namespace declarations at the end of the &lt;jaxws:endpoint/&gt; tag--these are required because the combined "{namespace}localName" syntax is presently not supported for this tag's attribute values.</p><p>The <code>jaxws:endpoint</code> element (which appears to create an <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxws/EndpointImpl.html">EndpointImpl</a> under the covers) supports many additional attributes:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>endpointName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The endpoint name this service is implementing, it maps to the wsdl:port@name. In the format of "ns:ENDPOINT_NAME" where ns is a namespace prefix valid at this scope.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>publish</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether the endpoint should be published now, or whether it will be published at a later point.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>serviceName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The service name this service is implementing, it maps to the wsdl:service@name. In the format of "ns:SERVICE_NAME" where ns is a namespace prefix valid at this scope.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wsdlLocation</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The location of the WSDL. Can be on the classpath, file system, or be hosted remotely.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bindingUri</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URI, or ID, of the message binding for the endpoint to use. For SOAP the binding URI(ID) is specified by the JAX-WS specification. For other message bindings the URI is the namespace of the WSDL extensions used to specify the binding.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>address</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The service publish address</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bus</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The bus name that will be used in the jaxws endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>implementor</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The implementor of jaxws endpoint. You can specify the implementor class name here, or just the ref bean name in the format of "#REF_BEAN_NAME"</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>implementorClass</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The implementor class name, it is really useful when you specify the implementor with the ref bean which is wrapped by using Spring AOP</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>createdFromAPI</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>This indicates that the endpoint bean was already created using jaxws API's thus at runtime when parsing the bean spring can use these values rather than the default ones. It's important that when this is true, the "name" of the bean is set to the port name of the endpoint being created in the form "{<span class="nolink">http://</span>service.target.namespace} PortName".</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>publishedEndpointUrl</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URL that is placed in the address element of the wsdl when the wsdl is retrieved. If not specified, the address listed above is used. This parameter allows setting the "public" URL that may not be the same as the URL the service is deployed on. (for example, the service is behind a proxy of some sort).</p></td></tr></tbody></table></div><p>It also supports many child elements:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:executor</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A Java executor which will be used for the service. This can be supplied using the Spring &lt;bean class="MyExecutor"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:inInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The incoming interceptors for this endpoint. A list of &lt;bean&gt;s or &lt;ref&gt;s. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:inFaultInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The incoming fault interceptors for this endpoint. A list of &lt;bean&gt;s or &lt;ref&gt;s. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:outInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The outgoing interceptors for this endpoint. A list of &lt;bean&gt;s or &lt;ref&gt;s. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:outFaultInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The outgoing fault interceptors for this endpoint. A list of &lt;bean&gt;s or &lt;ref&gt;s. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:handlers</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The JAX-WS handlers for this endpoint. A list of &lt;bean&gt;s or &lt;ref&gt;s. Each should implement <a shape="rect" class="external-link" href="https://docs.oracle.com/javase/8/docs/api/javax/xml/ws/handler/Handler.html" rel="nofollow">javax.xml.ws.handler.Handler</a> or <a shape="rect" class="external-link" href="https://docs.oracle.com/javase/8/docs/api/javax/xml/ws/handler/soap/SOAPHandler.html" rel="nofollow">javax.xml.ws.handler.soap.SOAPHandler</a> (Note that <code>@HandlerChain</code> annotations on the service bean appear to be ignored)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:properties</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A properties map which should be supplied to the JAX-WS endpoint. See below.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:dataBinding</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Which <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/databinding/DataBinding.html">DataBinding</a> to use in the endpoint. This can be supplied using the Spring &lt;bean class="MyDataBinding"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:binding</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>You can specify the BindingFactory for this endpoint to use. This can be supplied using the Spring &lt;bean class="MyBindingFactory"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:features</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The features that hold the interceptors for this endpoint. A list of &lt;bean&gt;s or &lt;ref&gt;s</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:invoker</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The invoker which will be supplied to this endpoint. This can be supplied using the Spring &lt;bean class="MyInvoker"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:schemaLocations</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The schema locations for endpoint to use. A list of &lt;schemaLocation&gt;s</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:serviceFactory</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The service factory for this endpoint to use. This can be supplied using the Spring &lt;bean class="MyServiceFactory"/&gt; syntax</p></td></tr></tbody></table></div><p>Here is a more advanced example which shows how to provide interceptors and properties:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"&gt;
&lt;import resource="classpath:META-INF/cxf/cxf.xml"/&gt;
&lt;import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/&gt;
&lt;jaxws:endpoint
id="helloWorld"
implementor="demo.spring.HelloWorldImpl"
address="http://localhost/HelloWorld"&gt;
&lt;jaxws:inInterceptors&gt;
&lt;bean class="com.acme.SomeInterceptor"/&gt;
&lt;ref bean="anotherInterceptor"/&gt;
&lt;/jaxws:inInterceptors&gt;
&lt;jaxws:properties&gt;
&lt;entry key="mtom-enabled" value="true"/&gt;
&lt;/jaxws:properties&gt;
&lt;/jaxws:endpoint&gt;
&lt;bean id="anotherInterceptor" class="com.acme.SomeInterceptor"/&gt;
&lt;jaxws:endpoint id="simpleWithBinding"
implementor="#greeter"
address="http://localhost:8080/simpleWithAddress"&gt;
&lt;jaxws:binding&gt;
&lt;soap:soapBinding mtomEnabled="true" version="1.2"/&gt;
&lt;/jaxws:binding&gt;
&lt;/jaxws:endpoint&gt;
&lt;jaxws:endpoint id="inlineInvoker"
address="http://localhost:8080/simpleWithAddress"&gt;
&lt;jaxws:implementor&gt;
&lt;bean class="org.apache.hello_world_soap_http.GreeterImpl"/&gt;
&lt;/jaxws:implementor&gt;
&lt;jaxws:invoker&gt;
&lt;bean class="org.apache.cxf.jaxws.spring.NullInvoker"/&gt;
&lt;/jaxws:invoker&gt;
&lt;/jaxws:endpoint&gt;
&lt;/beans&gt;
</pre>
</div></div><p>If you are a Spring user, you'll notice that the <code>jaxws:properties</code> element follows the Spring Map syntax.</p><h1 id="JAXWSConfiguration-ConfiguringaSpringClient(Option1)">Configuring a Spring Client (Option 1)</h1><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This technique lets you add a Web Services client to your Spring application. You can inject it into other Spring beans, or manually retrieve it from the Spring context for use by non-Spring-aware client code.</p></div></div><p>The easiest way to add a Web Services client to a Spring context is to use the <code>&lt;jaxws:client&gt;</code> element (similar to the <code>&lt;jaxws:endpoint&gt;</code> element used for the server side). Here's a simple example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"&gt;
&lt;jaxws:client id="helloClient"
serviceClass="demo.spring.HelloWorld"
address="http://localhost:9002/HelloWorld" /&gt;
&lt;/beans&gt;
</pre>
</div></div><p>The attributes available on <code>&lt;jaxws:client&gt;</code> include:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>id</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A unique identified for the client, which is how other beans in the context will reference it</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>address</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>URL</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URL to connect to in order to invoke the service</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>serviceClass</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Class</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The fully-qualified name of the interface that the bean should implement (typically, same as the service interface used on the server side)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>serviceName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>QName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the service to invoke, if this address/WSDL hosts several. It maps to the wsdl:service@name. In the format of "ns:SERVICE_NAME" where ns is a namespace prefix valid at this scope.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>endpointName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>QName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the endpoint to invoke, if this address/WSDL hosts several. It maps to the wsdl:port@name. In the format of "ns:ENDPOINT_NAME" where ns is a namespace prefix valid at this scope.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bindingId</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>URI</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URI, or ID, of the message binding for the endpoint to use. For SOAP the binding URI(ID) is specified by the JAX-WS specification. For other message bindings the URI is the namespace of the WSDL extensions used to specify the binding.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bus</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Bean Reference</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The bus name that will be used in the jaxws endpoint (defaults to <code>cxf</code>).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>username</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>password</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wsdlLocation</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>URL</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A URL to connect to in order to retrieve the WSDL for the service. This is not required.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>createdFromAPI</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>This indicates that the client bean was already created using jaxws API's thus at runtime when parsing the bean spring can use these values rather than the default ones. It's important that when this is true, the "name" of the bean is set to the port name of the endpoint being created in the form "{<span class="nolink">http://</span>service.target.namespace}PortName".</p></td></tr></tbody></table></div><p>It also supports many child elements:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:inInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The incoming interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:inFaultInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The incoming fault interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:outInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The outgoing interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:outFaultInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The outgoing fault interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:features</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The features that hold the interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:handlers</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The JAX-WS handlers for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" class="external-link" href="https://docs.oracle.com/javase/8/docs/api/javax/xml/ws/handler/Handler.html" rel="nofollow">javax.xml.ws.handler.Handler</a> or <a shape="rect" class="external-link" href="https://docs.oracle.com/javase/8/docs/api/javax/xml/ws/handler/soap/SOAPHandler.html" rel="nofollow">javax.xml.ws.handler.soap.SOAPHandler</a>. These are more portable than CXF interceptors, but may cause the full message to be loaded in as a DOM (slower for large messages).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:properties</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A properties map which should be supplied to the JAX-WS endpoint. See below.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:dataBinding</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Which <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/databinding/DataBinding.html">DataBinding</a> to use in the endpoint. This can be supplied using the Spring &lt;bean class="MyDataBinding"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:binding</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>You can specify the BindingFactory for this endpoint to use. This can be supplied using the Spring &lt;bean class="MyBindingFactory"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>jaxws:conduitSelector</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr></tbody></table></div><p>Here is a more advanced example which shows how to provide interceptors, JAX-WS handlers, and properties:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"&gt;
&lt;!-- Interceptors extend e.g.
org.apache.cxf.phase.AbstractPhaseInterceptor --&gt;
&lt;bean id="anotherInterceptor" class="..." /&gt;
&lt;!-- Handlers implement e.g. javax.xml.ws.handler.soap.SOAPHandler --&gt;
&lt;bean id="jaxwsHandler" class="..." /&gt;
&lt;!-- The SOAP client bean --&gt;
&lt;jaxws:client id="helloClient"
serviceClass="demo.spring.HelloWorld"
address="http://localhost:9002/HelloWorld"&gt;
&lt;jaxws:inInterceptors&gt;
&lt;bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/&gt;
&lt;ref bean="anotherInterceptor"/&gt;
&lt;/jaxws:inInterceptor&gt;
&lt;jaxws:handlers&gt;
&lt;ref bean="jaxwsHandler" /&gt;
&lt;/jaxws:handlers&gt;
&lt;jaxws:properties&gt;
&lt;entry key="mtom-enabled" value="true"/&gt;
&lt;/jaxws:properties&gt;
&lt;/jaxws:client&gt;
&lt;/beans&gt;
</pre>
</div></div><h1 id="JAXWSConfiguration-ConfiguringaSpringClient(Option2)">Configuring a Spring Client (Option 2)</h1><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Building a Client using this configuration is only applicable for those wishing to inject a Client into their Spring ApplicationContext.</p></div></div><p>This approach requires more explicit Spring bean configuration than the previous option, and may require more configuration data depending on which features are used. To configure a client this way, you'll need to declare a proxy factory bean and also a client bean which is created by that proxy factory. <span class="inline-comment-marker" data-ref="e36053fa-0a8c-4646-8de0-c06e4c7fdde7">Here is an example</span>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"&gt;
&lt;bean id="proxyFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"&gt;
&lt;property name="serviceClass" value="demo.spring.HelloWorld"/&gt;
&lt;property name="address" value="http://localhost:9002/HelloWorld"/&gt;
&lt;/bean&gt;
&lt;bean id="client" class="demo.spring.HelloWorld"
factory-bean="proxyFactory" factory-method="create"/&gt;
&lt;/beans&gt;
</pre>
</div></div><p>The JaxWsProxyFactoryBean in this case takes two properties. The service class, which is the interface of the Client proxy you wish to create. The address is the address of the service you wish to call.</p><p>The second bean definition is for the client. In this case it implements the HelloWorld interface and is created by the proxyFactory &lt;bean&gt; by calling the create() method. You can then reference this "client" bean and inject it anywhere into your application. Here is an example of a very simple Java class which accesses the client bean:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">include org.springframework.context.support.ClassPathXmlApplicationContext;
public final class HelloWorldClient {
private HelloWorldClient() { }
public static void main(String args[]) throws Exception {
ClassPathXmlApplicationContext context
= new ClassPathXmlApplicationContext(
new String[]{"my/path/to/client-beans.xml"});
HelloWorld client = (HelloWorld)context.getBean("client");
String response = client.sayHi("Dan");
System.out.println("Response: " + response);
System.exit(0);
}
}
</pre>
</div></div><p>The JaxWsProxyFactoryBean supports many other properties:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>clientFactoryBean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The ClientFactoryBean used in construction of this proxy.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>password</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The password which the transport should use.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>username</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The username which the transport should use.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wsdlURL</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The wsdl URL the client should use to configure itself.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wsdlLocation</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Appears to be the same as wsdlURL?</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>serviceName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the service to invoke, if this address/WSDL hosts several. It maps to the wsdl:service@name. In the format of "ns:SERVICE_NAME" where ns is a namespace prefix valid at this scope.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>endpointName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the endpoint to invoke, if this address/WSDL hosts several. It maps to the wsdl:port@name. In the format of "ns:ENDPOINT_NAME" where ns is a namespace prefix valid at this scope.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>inInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The incoming interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>inFaultInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The incoming fault interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>outInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The outgoing interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>outFaultInterceptors</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The outgoing fault interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements. Each should implement <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/Interceptor.html">org.apache.cxf.interceptor.Interceptor</a> or <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/phase/PhaseInterceptor.html">org.apache.cxf.phase.PhaseInterceptor</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>features</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The features that hold the interceptors for this endpoint. A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>handlers</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A list of <code>&lt;bean&gt;</code> or <code>&lt;ref&gt;</code> elements pointing to JAX-WS handler classes to be used for this client. Each should implement <a shape="rect" class="external-link" href="https://docs.oracle.com/javase/8/docs/api/javax/xml/ws/handler/Handler.html" rel="nofollow">javax.xml.ws.handler.Handler</a> or <a shape="rect" class="external-link" href="https://docs.oracle.com/javase/8/docs/api/javax/xml/ws/handler/soap/SOAPHandler.html" rel="nofollow">javax.xml.ws.handler.soap.SOAPHandler</a>. These are more portable than CXF interceptors, but may cause the full message to be loaded in as a DOM (slower for large messages).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bindingConfig</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bindingId</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URI, or ID, of the message binding for the endpoint to use. For SOAP the binding URI(ID) is specified by the JAX-WS specification. For other message bindings the URI is the namespace of the WSDL extensions used to specify the binding.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bus</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A reference to a CXF bus bean. Must be provided if, for example, handlers are used. May require additional Spring context imports (e.g. to bring in the default CXF bus bean).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>conduitSelector</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>dataBinding</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Which <a shape="rect" href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/databinding/DataBinding.html">DataBinding</a> to use in the endpoint. This can be supplied using the Spring &lt;bean class="MyDataBinding"/&gt; syntax.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>properties</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A properties map which should be supplied to the JAX-WS endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>serviceFactory</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr></tbody></table></div><p>Using some of the properties will require additional configuration in the Spring context. For instance, using JAX-WS handlers requires that you explicitly import several CXF Spring configurations, and assign the "bus" property of the JaxWsProxyFactory bean like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;import resource="classpath:META-INF/cxf/cxf.xml" /&gt;
&lt;import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /&gt;
&lt;import resource="classpath:META-INF/cxf/cxf-extension-http.xml" /&gt;
&lt;bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"&gt;
&lt;property name="serviceClass" value="demo.spring.HelloWorld"/&gt;
&lt;property name="address" value="http://localhost:9002/HelloWorld"/&gt;
&lt;property name="bus" ref="cxf" /&gt;
&lt;/bean&gt;
</pre>
</div></div><h1 id="JAXWSConfiguration-ConfiguringanEndpoint/ClientProxyUsingCXFAPIs">Configuring an Endpoint/Client Proxy Using CXF APIs</h1><p>JAX-WS endpoints and client proxies are implemented on top of CXF's frontend-neutral endpoint API. You can therefore use CXF APIs to enhance the functionality of a JAX-WS endpoint or client proxy, for example by adding interceptors.</p><p>To cast a client proxy to a CXF client:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">GreeterService gs = new GreeterService();
Greeter greeter = gs.getGreeterPort();
org.apache.cxf.endpoint.Client client =
org.apache.cxf.frontend.ClientProxy.getClient(greeter);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
cxfEndpoint.getOutInterceptors().add(...);
</pre>
</div></div><p>To cast a JAX-WS endpoint to a CXF server:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">javax.xml.ws.Endpoint jaxwsEndpoint = javax.xml.ws.Endpoint.publish(
"http://localhost:9020/SoapContext/GreeterPort", new GreeterImpl());
org.apache.cxf.jaxws.EndpointImpl jaxwsEndpointImpl =
(org.apache.cxf.jaxws.EndpointImpl)jaxwsEndpoint;
jaxwsEndpointImpl.getOutInterceptors().add(...);
</pre>
</div></div><h1 id="JAXWSConfiguration-ConfiguretheJAXWSServer/ClientUsingSpring">Configure the JAXWS Server/Client Using Spring</h1><p>CXF provides &lt;jaxws:server&gt;, &lt;jaxws:client&gt; to configure the server/client side endpoint. Here are some examples:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"&gt;
&lt;jaxws:server id="inlineImplementor" address="http://localhost:8080/simpleWithAddress"&gt;
&lt;jaxws:serviceBean&gt;
&lt;bean class="org.apache.hello_soap_http.GreeterImpl"/&gt;
&lt;/jaxws:serviceBean&gt;
&lt;/jaxws:server&gt;
&lt;jaxws:server id="bookServer" serviceClass=
"org.apache.cxf.mytype.AnonymousComplexTypeImpl"
address="http://localhost:8080/act"
bus="cxf"&gt;
&lt;jaxws:invoker&gt;
&lt;bean class="org.apache.cxf.service.invoker.BeanInvoker"&gt;
&lt;constructor-arg&gt;
&lt;bean class="org.apache.cxf.mytype.AnonymousComplexTypeImpl"/&gt;
&lt;/constructor-arg&gt;
&lt;/bean&gt;
&lt;/jaxws:invoker&gt;
&lt;jaxws:dataBinding&gt;
&lt;bean class="org.apache.cxf.jaxb.JAXBDataBinding"&gt;
&lt;property name="namespaceMap"&gt;
&lt;map&gt;
&lt;entry&gt;
&lt;key&gt;
&lt;value&gt;http://cxf.apache.org/anon_complex_type/&lt;/value&gt;
&lt;/key&gt;
&lt;value&gt;BeepBeep&lt;/value&gt;
&lt;/entry&gt;
&lt;/map&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;/jaxws:dataBinding&gt;
&lt;/jaxws:server&gt;
&lt;jaxws:client id="bookClient"
serviceClass="org.apache.cxf.mytype.AnonymousComplexType"
address="http://localhost:8080/act"/&gt;
&lt;/beans&gt;
</pre>
</div></div><p>Since JAX-WS frontend server and client spring configuration parser are inherited from the simple frontend, please see <a shape="rect" href="simple-frontend-configuration.html">Simple Frontend Configuration</a> for the attribute and element definitions.</p><p>&#160;</p><h1 id="JAXWSConfiguration-ConfiguretheJAXWSServerUsingSpringBoot">Configure the JAXWS Server Using SpringBoot</h1><p>Here is an example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration
@EnableAutoConfiguration
@ImportResource({ "classpath:META-INF/cxf/cxf.xml" })
public class Application extends SpringBootServletInitializer {
@Autowired
private ApplicationContext applicationContext;
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
// Replaces the need for web.xml
@Bean
public ServletRegistrationBean servletRegistrationBean(ApplicationContext context) {
return new ServletRegistrationBean(new CXFServlet(), "/api/*");
}
// Replaces cxf-servlet.xml
@Bean
// &lt;jaxws:endpoint id="helloWorld" implementor="demo.spring.service.HelloWorldImpl" address="/HelloWorld"/&gt;
public EndpointImpl helloService() {
Bus bus = (Bus) applicationContext.getBean(Bus.DEFAULT_BUS_ID);
Object implementor = new HelloWorldImpl();
EndpointImpl endpoint = new EndpointImpl(bus, implementor);
endpoint.publish("/hello");
return endpoint;
}
// Used when deploying to a standalone servlet container, i.e. tomcat
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}</pre>
</div></div><p>&#160;</p><p>&#160;</p></div>
</div>
<!-- Content -->
</td>
</tr>
</table>
</td>
<td id="cell-2-2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td id="cell-3-0">&nbsp;</td>
<td id="cell-3-1">&nbsp;</td>
<td id="cell-3-2">
<div id="footer">
<!-- Footer -->
<div id="site-footer">
<a href="http://cxf.apache.org/privacy-policy.html">Privacy Policy</a> -
(<a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=49965">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49965&amp;showComments=true&amp;showCommentArea=true#addcomment">add comment</a>)<br>
Apache CXF, CXF, Apache, the Apache feather logo are trademarks of The Apache Software Foundation.<br>
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
<!-- Footer -->
</div>
</td>
<td id="cell-3-3">&nbsp;</td>
<td id="cell-3-4">&nbsp;</td>
</tr>
<tr>
<td id="cell-4-0" colspan="2">&nbsp;</td>
<td id="cell-4-1">&nbsp;</td>
<td id="cell-4-2" colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-4458903-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>