Author: buildbot
Date: Mon Oct 26 01:42:55 2026
New Revision: 1094366
Log:
Production update by buildbot for cxf
Modified:
websites/production/cxf/content/cache/docs.pageCache
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary file (source and/or target). No diff available.
Modified:
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
==============================================================================
---
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
Mon Oct 26 01:41:30 2026 (r1094365)
+++
websites/production/cxf/content/docs/client-http-transport-including-ssl-support.html
Mon Oct 26 01:42:55 2026 (r1094366)
@@ -96,7 +96,8 @@ Apache CXF -- Client HTTP Transport (inc
<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><li><a
shape="rect" href="securing-cxf-services.html">Securing CXF
Services</a></li></ul><hr><ul
class="alternate"><li><p>Search</p></li></ul><iframe frameborder="1"
scrolling="auto" id="searchId"
src="https://cxf.apache.org/resources/search.htm" name="SearchIFrame"
width="200px" style="border:none;" title="Search" height="60px"><p><br
clear="none"></p></iframe>
+<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><li><a
shape="rect" href="securing-cxf-services.html">Securing CXF
Services</a></li></ul><hr><ul class="alternate"><li><p>Search</p></li></ul>
+<iframe frameborder="1" scrolling="auto" id="searchId"
src="https://cxf.apache.org/resources/search.htm" sandbox="sandbox"
name="SearchIFrame" width="200px" style="border:none;" title="Search"
height="60px"></iframe>
<hr><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-4.0.x/">API 4.0.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.6.x/">API 3.6.x
(Javadoc)</a></li><li><a shape="rect"
href="http://cxf.apache.org/javadoc/latest-3.5.x/">API 3.5.x
(Javadoc)</a></li><li><a shape="rect" href="http://cxf.apache.org/">CXF
Website</a></li></ul><p><br clear="none"></p><p><a shape="rect"
class="external-link" href="https://www.apache.org/events/current-event.html">
<span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
draggable="false" src="https://www.apache.org/events/current-event-125x125.png"
data-image-src="https://www.apache.org/events/current-event-125x125.png"></span>
</a></p></div>
@@ -110,11 +111,11 @@ Apache CXF -- Client HTTP Transport (inc
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1747878171843 {padding: 0px;}
-div.rbtoc1747878171843 ul {margin-left: 0px;}
-div.rbtoc1747878171843 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1792978968028 {padding: 0px;}
+div.rbtoc1792978968028 ul {margin-left: 0px;}
+div.rbtoc1792978968028 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1747878171843">
+/*]]>*/</style></p><div class="toc-macro rbtoc1792978968028">
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-DefaultClientTransport">Default
Client Transport</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Authentication">Authentication</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-BasicAuthentication">Basic
Authentication</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-DigestAuthentication">Digest
Authentication</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Supplyingdynamicauthorization">Supplying
dynamic authorization</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-SpnegoAuthentication(Kerberos)">Spnego
Authentication (Kerberos)</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-CredentialDelegation">Credential
Delegation</a></li></ul>
@@ -130,8 +131,8 @@ div.rbtoc1747878171843 li {margin-left:
<ul class="toc-indentation"><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-HowtoconfiguretheHTTPConduitfortheSOAPClient?">How
to configure the HTTPConduit for the SOAP Client?</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-HowtouseHTTPConduitConfigurer?">How
to use HTTPConduitConfigurer?</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Howtooverridetheserviceaddress?">How
to override the service address ?</a></li></ul>
</li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-ClientCacheControlDirectives">Client
Cache Control Directives</a></li></ul>
</li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-ANoteAboutChunking">A Note
About Chunking</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-Whentosetcustomheaders">When to
set custom headers</a></li><li><a shape="rect"
href="#ClientHTTPTransport(includingSSLsupport)-AsynchronousHTTPConduit">Asynchronous
HTTP Conduit</a></li></ul>
-</div><h1
id="ClientHTTPTransport(includingSSLsupport)-DefaultClientTransport">Default
Client Transport</h1><p>Prior to Apache CXF 3.6.0 / 4.0.1, the default HTTP
client transport was <span><span style="color:
rgb(0,0,0);"><strong>URLConnectionHTTPConduit</strong>, that is built on top of
<strong><a shape="rect" class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.</strong></span></span><strong>HttpURLConnection</strong>
/ <strong><span style="color: rgb(0,0,0);"><a shape="rect"
class="external-link" href="http://javax.net"
rel="nofollow">javax.net</a>.ssl.</span></strong><span><span style="color:
rgb(0,0,0);"><strong>HttpsURLConnection</strong> (JDK standard library). Past
these releases, the default HTTP client transport has become
<strong>HttpClientHTTPConduit </strong>that is using<strong> <a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> under the hood (see please
<a shape="rect" class="external
-link" href="https://openjdk.org/jeps/321" rel="nofollow">JEP 321: HTTP
Client</a>).</span></span></p><div class="confluence-information-macro
confluence-information-macro-warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">The <strong><a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> is reported to be
considerably slower than <strong><a shape="rect" class="external-link"
href="http://java.net" rel="nofollow">java.net</a>.HttpURLConnection</strong>
(see please <a shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8277519"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8277519</a>), so there is an
option to revert the default to <strong>URLConnectionHTTPConduit </strong>by
setting <strong>"force.urlconnection.http.conduit"</strong> contextual property
to <code>true</code>  .</div></div>
<div class="confluence-information-macro
confluence-information-macro-warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The <strong><a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> is very heavy and hungry
for resources (heap and threads primarily). Apache CXF tries to countermeasure
that by sharing a single  <strong><a shape="rect" class="external-link"
href="http://java.net" rel="nofollow">java.net</a>.http.HttpClient</strong>
instance across many HTTP client conduits if possible (subject to HTTP client
policy and SSL/TLS settings). This behaviour could be changed by setting <code
class="notranslate">share.httpclient.http.conduit</code> contextual property to
<code class="notranslate">false</code> (the default value is <code
class="notranslate">true</code>), in this case a new <strong><a shape="rect"
class=
"external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> instance is going to be
created per HTTP client conduit.</p></div></div><div
class="confluence-information-macro confluence-information-macro-warning"><span
class="aui-icon aui-icon-small aui-iconfont-error
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The <strong><a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> support of timeouts (send
/ receive) is incomplete:</p><p> - <a shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8258397"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8258397</a></p><p> - <a
shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8208693"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8208693</a></p><p> - <a
shape="rect" class="external-link" href="https://bugs.openjdk.org/browse/JDK-82
54223"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8254223</a></p></div></div><p
class="auto-cursor-target">Another contextual properties include:</p><div
class="table-wrap"><table class="relative-table wrapped confluenceTable"
style="width: 62.3436%;"><colgroup span="1"><col span="1" style="width:
24.4233%;"><col span="1" style="width: 12.1559%;"><col span="1" style="width:
63.4561%;"></colgroup><tbody><tr><th colspan="1" rowspan="1" scope="col"
class="confluenceTh">Contextual Property</th><th colspan="1" rowspan="1"
scope="col" class="confluenceTh">Default Value</th><th colspan="1" rowspan="1"
scope="col" class="confluenceTh">Description</th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><span><span style="color:
rgb(0,0,0);"><span style="color:
rgb(42,0,255);">force.urlconnection.http.conduit</span></span></span></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td
colspan="1" rowspan="1" class="confluenceTd">Reverts the default
HTTP client to <strong>URLConnectionHTTPConduit (</strong>by setting
<code>true</code>)</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><span><span style="color: rgb(0,0,0);"><span style="color:
rgb(42,0,255);"><span style="color: rgb(0,0,0);"><span style="color:
rgb(42,0,255);">share.httpclient.http.conduit</span></span></span></span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Shares the underlying
<code>HttpClient</code> instance for the each unique
<code>HttpClientPolicy</code> in ordre to reduce the memory / threading
footprint. Set to <code>false</code> to disable sharing.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><span><span style="color:
rgb(0,0,0);"><span style="color: rgb(42,0,255);"><span style="color:
rgb(0,0,0);"><span style="color: rgb(42,0,255);"><span style="color:
rgb(0,0,0);"><span style="color: rgb(42,0,255);">https.reset.httpclient.http
.conduit</span></span></span></span></span></span></span></td><td colspan="1"
rowspan="1" class="confluenceTd"><code>true</code></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Reverts the underlying
<code>HttpClient</code> instance upon HTTPS URL change.  Set to
<code>false</code> to disable resetting.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><span><span style="color: rgb(0,0,0);"><span
style="color:
rgb(42,0,255);">org.apache.cxf.transport.http.forceVersion</span></span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>By default, <a shape="rect"
class="external-link"
href="https://docs.oracle.com/en/java/javase/21/docs/api/java.net.http/java/net/http/HttpClient.html"
rel="nofollow"> java.net.http.HttpClient</a> prefers HTTP/2 protocol (if
supported by the server). To override this behavior and prefer HTTP/1.1
instead, set this property to <code>"1.1"</code>.<
/p></td></tr></tbody></table></div><h1
id="ClientHTTPTransport(includingSSLsupport)-Authentication">Authentication</h1><h2
id="ClientHTTPTransport(includingSSLsupport)-BasicAuthentication">Basic
Authentication</h2><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> <conduit
name="{http://example.com/}HelloWorldServicePort.http-conduit"
+</div><h1
id="ClientHTTPTransport(includingSSLsupport)-DefaultClientTransport">Default
Client Transport</h1><p>Prior to Apache CXF 3.6.0 / 4.0.1, the default HTTP
client transport was <span style="color:var(--ds-text,#000000);"><span
style="color:var(--ds-text,#000000);"><strong>URLConnectionHTTPConduit</strong>,
that is built on top of <strong><a shape="rect" class="external-link"
href="http://java.net"
rel="nofollow">java.net</a>.</strong></span></span><strong>HttpURLConnection</strong>
/ <strong><span style="color:var(--ds-text,#000000);"><a shape="rect"
class="external-link" href="http://javax.net"
rel="nofollow">javax.net</a>.ssl.</span></strong><span
style="color:var(--ds-text,#000000);"><span
style="color:var(--ds-text,#000000);"><strong>HttpsURLConnection</strong> (JDK
standard library). Past these releases, the default HTTP client transport has
become <strong>HttpClientHTTPConduit </strong>that is using<strong> <a
shape="rect" class="external-link" href="http://java.net" re
l="nofollow">java.net</a>.http.HttpClient</strong> under the hood (see please
<a shape="rect" class="external-link" href="https://openjdk.org/jeps/321"
rel="nofollow">JEP 321: HTTP Client</a>).</span></span></p><div
class="confluence-information-macro confluence-information-macro-warning"
role="region" aria-label="Warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"
role="presentation"></span><div class="confluence-information-macro-body">The
<strong><a shape="rect" class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> is reported to be
considerably slower than <strong><a shape="rect" class="external-link"
href="http://java.net" rel="nofollow">java.net</a>.HttpURLConnection</strong>
(see please <a shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8277519"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8277519</a>), so there is an
option to revert the default to <
strong>URLConnectionHTTPConduit </strong>by setting
<strong>"force.urlconnection.http.conduit"</strong> contextual property to
<code>true</code>  .</div></div><div class="confluence-information-macro
confluence-information-macro-warning" role="region" aria-label="Warning"><span
class="aui-icon aui-icon-small aui-iconfont-error
confluence-information-macro-icon" role="presentation"></span><div
class="confluence-information-macro-body"><p>The <strong><a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> is very heavy and hungry
for resources (heap and threads primarily). Apache CXF tries to countermeasure
that by sharing a single  <strong><a shape="rect" class="external-link"
href="http://java.net" rel="nofollow">java.net</a>.http.HttpClient</strong>
instance across many HTTP client conduits if possible (subject to HTTP client
policy and SSL/TLS settings). This behaviour could be changed by setting <code
class="notr
anslate">share.httpclient.http.conduit</code> contextual property to <code
class="notranslate">false</code> (the default value is <code
class="notranslate">true</code>), in this case a new <strong><a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> instance is going to be
created per HTTP client conduit.</p></div></div><div
class="confluence-information-macro confluence-information-macro-warning"
role="region" aria-label="Warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"
role="presentation"></span><div
class="confluence-information-macro-body"><p>The <strong><a shape="rect"
class="external-link" href="http://java.net"
rel="nofollow">java.net</a>.http.HttpClient</strong> support of timeouts (send
/ receive) is incomplete:</p><p> - <a shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8258397"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-
8258397</a></p><p> - <a shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8208693"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8208693</a></p><p> - <a
shape="rect" class="external-link"
href="https://bugs.openjdk.org/browse/JDK-8254223"
rel="nofollow">https://bugs.openjdk.org/browse/JDK-8254223</a></p></div></div><p
class="auto-cursor-target">Another contextual properties include:</p><div
class="table-wrap"><table class="relative-table wrapped confluenceTable"
style="width: 62.3436%;"><colgroup span="1"><col span="1" style="width:
24.4233%;"><col span="1" style="width: 12.1559%;"><col span="1" style="width:
63.4561%;"></colgroup><tbody><tr><th colspan="1" rowspan="1" scope="col"
class="confluenceTh">Contextual Property</th><th colspan="1" rowspan="1"
scope="col" class="confluenceTh">Default Value</th><th colspan="1" rowspan="1"
scope="col" class="confluenceTh">Description</th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><sp
an style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">force.urlconnection.http.conduit</span></span></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td
colspan="1" rowspan="1" class="confluenceTd">Reverts the default HTTP client to
<strong>URLConnectionHTTPConduit (</strong>by setting
<code>true</code>)</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><span
style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">share.httpclient.http.conduit</span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Shares the underlying
<code>HttpClient</code> instance for the each unique
<code>HttpClientPolicy</code> in ordre to reduce the memory / threading
footprint. Set to <code>false</code> to disable sharing.</p></td></tr><tr><td
colspan="1" rowspan="1" class="con
fluenceTd"><span style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">https.reset.httpclient.http.conduit</span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><code>true</code></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Reverts the underlying
<code>HttpClient</code> instance upon HTTPS URL change.  Set to
<code>false</code> to disable resetting.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><span
style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">org.apache.cxf.transport.http.forceVersion</span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>By default, <a shape="rect"
class="external-link"
href="https://docs.oracle.com/en/java/javase/21/docs/api/java.net.http/java/net/http/HttpClient.html"
rel="nofollow"> java.net.http.HttpClient</a> prefe
rs HTTP/2 protocol (if supported by the server). To override this behavior and
prefer HTTP/1.1 instead, set this property to
<code>"1.1"</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><span
style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">http.redirect.same.host.only</span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Restricts auto redirects to the
same host & scheme only</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><span
style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">http.redirect.relative.uri</span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Restricts auto redirects to
relative URI</p></td></tr><tr><td colspan="1" rowspan="1" class="confl
uenceTd"><span style="color:var(--ds-text-accent-blue,#0055cc);"><span
style="color:var(--ds-text-accent-blue,#0055cc);">http.redirect.allowed.uri</span></span></td><td
colspan="1" rowspan="1" class="confluenceTd"><br clear="none"></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Restricts auto redirects to URI
prefix</p></td></tr></tbody></table></div><h1
id="ClientHTTPTransport(includingSSLsupport)-Authentication">Authentication</h1><h2
id="ClientHTTPTransport(includingSSLsupport)-BasicAuthentication">Basic
Authentication</h2><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false"> <conduit
name="{http://example.com/}HelloWorldServicePort.http-conduit"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns="http://cxf.apache.org/transports/http/configuration">
<authorization>
@@ -142,12 +143,12 @@ div.rbtoc1747878171843 li {margin-left:
</conduit>
</pre>
</div></div><p>Note: The AuthorizationType element can be omitted if you're
using Basic authentication, as above.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-DigestAuthentication">Digest
Authentication</h2><p>Same as above but use AuthorizationType "Digest".</p><h2
id="ClientHTTPTransport(includingSSLsupport)-Supplyingdynamicauthorization">Supplying
dynamic authorization</h2><p>You can implement the
org.apache.cxf.transport.http.auth.HttpAuthSupplier interface or one of its
implementations.</p><p>The main method this interface provides is:<br
clear="none">public String getAuthorization(AuthorizationPolicy authPolicy, URL
currentURL, Message message, String fullHeader);</p><p>So you get the
HttpAuthPolicy, the service URL, the CXF message and the full Authorization
header. The fullHeader is the Authorization Header the server sent after the
last try. This way you can implement multi phase authentications. You are
expected to return the authorization Header to send to the serv
er. For a simple implementation you can look at
org.apache.cxf.transport.http.auth.DefaultBasicAuthSupplier.</p><p>If you set
your implementation class as AuthSupplier on the conduit CXF will use
it.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-SpnegoAuthentication(Kerberos)">Spnego
Authentication (Kerberos)</h2><p>Starting with CXF 2.4.0 CXF supports Spnego
authentication using the standard AuthPolicy mechanism. Spnego is activated by
setting the AuthPolicy.authorizationType to 'Negotiate'. If userName is left
blank then single sign on is used with the TGT from e.g. Windows Login. If
userName is set then a new LoginContext is established and the ticket is
created out of this.</p><p>By default the SpnegoAuthSupplier uses the OID for
Spnego. Some servers require the OID for Kerberos. This can be activated by
setting the contextual property auth.spnego.useKerberosOid to
'true'.</p><p>Kerberos Config:</p><p>Make sure that krb5.conf/krb5.ini is
configured correctly for the Kerber
os realm you want to authenticate against<br clear="none">and supply it to
your application by setting the java.security.krb5.conf system
property</p><p>Login Config:</p><p>Create a file login.conf and supply it to
CXF using the System property java.security.auth.login.config.</p><p>The file
should contain:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default">CXFClient {
+<pre class="brush: java; gutter: false">CXFClient {
com.sun.security.auth.module.Krb5LoginModule required client=TRUE
useTicketCache=true;
};
</pre>
</div></div><p>Sample config:</p><p>Make sure the Authorization element
contains the same name as the Section in the login.conf (here:
CXFClient).</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>HTTP
conduit configuration for spnego with single sign on</b></div><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> ...
+<pre class="brush: java; gutter: false"> ...
<conduit name="{http://example.com/}HelloWorldServicePort.http-conduit"
xmlns="http://cxf.apache.org/transports/http/configuration">
<authorization>
@@ -158,7 +159,7 @@ div.rbtoc1747878171843 li {margin-left:
...
</pre>
</div></div><p>You can use UserName and Password in the above xml config if
you want to log in explicitly. If you want to use the cached Ticket Granting
Ticket then do not supply them.</p><p>On windows you will also have to make
sure you allow the TGT to be used in Java. See: <a shape="rect"
class="external-link" href="http://www.javaactivedirectory.com/?page_id=93"
rel="nofollow">http://www.javaactivedirectory.com/?page_id=93</a></p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Switching to Kerberos OID
instead of Spnego</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> ...
+<pre class="brush: java; gutter: false"> ...
<jaxws:client>
<jaxws:properties>
<entry key="auth.spnego.useKerberosOid" value="true"/>
@@ -167,7 +168,7 @@ div.rbtoc1747878171843 li {margin-left:
...
</pre>
</div></div><h3
id="ClientHTTPTransport(includingSSLsupport)-CredentialDelegation">Credential
Delegation</h3><p>Please set an "auth.spnego.requireCredDelegation" property to
"true" if you need to enable the credential delegation. Note that setting this
property will let the receiving service implement the credential
delegation.</p><p>If the Kerberos credential is already available in the
service request context then one can make this credential available to
Spnego/Kerberos authentication handler by setting it on the current CXF
message, using an 'org.ietf.jgss.GSSCredential' key.</p><p>This can be done
before a client invocation is made, by setting a client request context
property, or by extending
'org.apache.cxf.transport.http.auth.AbstractSpnegoAuthSupplier'. Please see
this <a shape="rect" class="external-link"
href="http://cxf.547215.n5.nabble.com/Kerberos-authentication-using-delegation-from-Principal-Ticket-td5711202.html"
rel="nofollow">thread</a> for more information on the
latter option.</p><p>Note in the case of reusing the existing credential, the
policy configuration does not need to reference a login module name:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>HTTP conduit
configuration for spnego with single sign on</b></div><div class="codeContent
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> ...
+<pre class="brush: java; gutter: false"> ...
<conduit name="{http://example.com/}HelloWorldServicePort.http-conduit"
xmlns="http://cxf.apache.org/transports/http/configuration">
<authorization>
@@ -177,7 +178,7 @@ div.rbtoc1747878171843 li {margin-left:
...
</pre>
</div></div><h2
id="ClientHTTPTransport(includingSSLsupport)-NTLMAuthentication">NTLM
Authentication</h2><p>CXF doesn't support NTLM authentication "out of the box"
on Java 5, but with some additional libraries and configuration, the standard
HttpURLConnection objects that we use can do the NTLM authentication. On Java
6, NTLM authentication is built into the Java runtime and you don't need to do
anything special.</p><p>On Java 5, you need a library that will augment the
HttpURLConnection to do it. See: <a shape="rect" class="external-link"
href="http://jcifs.samba.org/src/docs/httpclient.html"
rel="nofollow">http://jcifs.samba.org/src/docs/httpclient.html</a> Note: jcifs
is LGPL licensed, not Apache licensed.</p><p>Next, you need to configure jcifs
to use the correct domains, wins servers, etc... Notice that the<br
clear="none">bit which sets the username/password to use for NTLM is commented
out. If credentials are<br clear="none">missing jcifs will use the underlying
NT credentia
ls.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default">//Set the jcifs
properties
+<pre class="brush: java; gutter: false">//Set the jcifs properties
jcifs.Config.setProperty("jcifs.smb.client.domain", "ben.com");
jcifs.Config.setProperty("jcifs.netbios.wins", "xxx.xxx.xxx.xxx");
jcifs.Config.setProperty("jcifs.smb.client.soTimeout", "300000"); // 5 minutes
@@ -189,7 +190,7 @@ jcifs.Config.setProperty("jcifs.netbios.
jcifs.Config.registerSmbURLHandler();
</pre>
</div></div><p>Finally, you need to setup the CXF client to turn off chunking.
The reason is that the NTLM authentication requires a 3 part handshake which
breaks the streaming.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default">//Turn off chunking so
that NTLM can occur
+<pre class="brush: java; gutter: false">//Turn off chunking so that NTLM can
occur
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
@@ -198,7 +199,7 @@ httpClientPolicy.setAllowChunking(false)
http.setClient(httpClientPolicy);
</pre>
</div></div><p>Please also see <a shape="rect"
href="https://cwiki.apache.org/confluence/display/CXF20DOC/Asynchronous+Client+HTTP+Transport">Asynchronous
HTTP Conduit</a> for more information on NTLM.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-ProxyAuthentication">Proxy
Authentication</h2><p>Proxy authentication can be configured as
follows.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> <conduit
name="{http://example.com/}HelloWorldServicePort.http-conduit"
+<pre class="brush: java; gutter: false"> <conduit
name="{http://example.com/}HelloWorldServicePort.http-conduit"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns="http://cxf.apache.org/transports/http/configuration">
<proxyAuthorization>
@@ -208,9 +209,9 @@ http.setClient(httpClientPolicy);
<client AllowChunking="false" ProxyServer="localhost"
ProxyServerPort="8080" />
</conduit></pre>
</div></div><p>This works over HTTPS and HTTPS, but note for the latter it is
necessary to set the following system property (see <a shape="rect"
class="external-link"
href="https://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html"
rel="nofollow">here</a> for more information "Disable Basic authentication for
HTTPS tunneling"):</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme:
Default">-Djdk.http.auth.tunneling.disabledSchemes=</pre>
+<pre class="brush: java; gutter:
false">-Djdk.http.auth.tunneling.disabledSchemes=</pre>
</div></div><p><br clear="none"></p><h1
id="ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport">Configuring
SSL Support</h1><p>When using an "https" URL, CXF will, by default, use the
certs and keystores that are part of the JDK. For many HTTPs applications, that
is enough and no configuration is necessary. However, when using custom client
certificates or self signed server certificates or similar, you may need to
specifically configure in the keystores and trust managers and such to
establish the SSL connection.</p><p>To configure your client to use SSL, you'll
need to add an <http:conduit> definition to your XML configuration file.
See the <a shape="rect" href="configuration.html">Configuration</a> guide to
learn how to supply your own XML configuration file to CXF. If you are already
using Spring, this can be added to your existing beans definitions.</p><p>A <a
shape="rect" class="external-link"
href="https://github.com/apache/cxf/tree/master/distribution/src/m
ain/release/samples/wsdl_first_https/" rel="nofollow">wsdl_first_https</a>
sample can be found in the CXF distribution with more detail.</p><p>Here is a
sample of what your conduit definition might look like:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"><beans
xmlns="http://www.springframework.org/schema/beans"
+<pre class="brush: java; gutter: false"><beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
@@ -258,12 +259,12 @@ http.setClient(httpClientPolicy);
</beans>
</pre>
</div></div><p>The first thing to notice is the "name" attribute on
<http:conduit>. This allows CXF to associate this HTTP Conduit
configuration with a particular WSDL Port. The name includes the service's
namespace, the WSDL port name (as found in the wsdl:service section of the
WSDL), and ".http-conduit". It follows this template: "{WSDL
Namespace}portName.http-conduit". Note: it's the PORT name, not the service
name. Thus, it's likely something like "MyServicePort", not "MyService". If you
are having trouble getting the template to work, another (temporary) option for
the name value is simply "*.http-conduit".</p><p>Another option for the name
attribute is a reg-ex expression (e.g., "http://localhost:*") for the ORIGINAL
URL of the endpoint. The configuration is matched at conduit creation so the
address used in the WSDL or used for the JAX-WS Service.create(...) call can be
used for the name. For example, you can do:</p><div class="code panel pdl"
style="border-width: 1px;
"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> <http:conduit
name="http://localhost:8080/.*">
+<pre class="brush: java; gutter: false"> <http:conduit
name="http://localhost:8080/.*">
......
</http:conduit>
</pre>
</div></div><p>to configure a conduit for all interactions on localhost:8080.
If you have multiple clients interacting with different services on the same
server, this is probably the easiest way to configure it.</p><p>If your service
endpoint uses an SSL WSDL location (i.e., "https://xxx?wsdl"), you can
configure the http conduit to pick up the SSL configuration by using a
hardcoded http conduit name of "{<a shape="rect"
href="http://cxf.apache.org/">http://cxf.apache.org</a>}TransportURIResolver.http-conduit".
The specific HTTP conduit name or a reg-ex expression can still be
used.</p><p>Keystores (as identified by the sec:keyStore element above) can be
identified via any one of three ways: via a file, resource, or url attribute.
File locations are either an absolute path or relative to the working
directory, the resource attribute is relative to the classpath, and URLs must
be a valid URL such as "http://..." "file:///...", etc. Only one attribute of
"url", "file", or "resource"
is allowed.</p><h1
id="ClientHTTPTransport(includingSSLsupport)-AdvancedConfiguration">Advanced
Configuration</h1><p>HTTP client endpoints can specify a number of HTTP
connection attributes including whether the endpoint automatically accepts
redirect responses, whether the endpoint can use chunking, whether the endpoint
will request a keep-alive, and how the endpoint interacts with proxies.</p><p>A
client endpoint can be configured using three
mechanisms:</p><ul><li>Configuration</li><li>WSDL</li><li>Java
code</li></ul><h2
id="ClientHTTPTransport(includingSSLsupport)-UsingConfiguration">Using
Configuration</h2><h3
id="ClientHTTPTransport(includingSSLsupport)-Namespace">Namespace</h3><p>The
elements used to configure an HTTP client are defined in the namespace <code><a
shape="rect"
href="http://cxf.apache.org/transports/http/configuration">http://cxf.apache.org/transports/http/configuration</a></code>.
It is commonly referred to using the prefix <code>http-conf</code>. In order
to u
se the HTTP configuration elements you will need to add the lines shown below
to the beans element of your endpoint's configuration file. In addition, you
will need to add the configuration elements' namespace to the
<code>xsi:schemaLocation</code> attribute.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>HTTP Consumer Configuration
Namespace</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"><beans ...
+<pre class="brush: java; gutter: false"><beans ...
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration
...
xsi:schemaLocation="...
@@ -272,7 +273,7 @@ http.setClient(httpClientPolicy);
...">
</pre>
</div></div><h3
id="ClientHTTPTransport(includingSSLsupport)-Theconduitelement">The
<code>conduit</code> element</h3><p>You configure an HTTP client using the
<code>http-conf:conduit</code> element and its children. The
<code>http-conf:conduit</code> element takes a single attribute,
<code>name</code>, that specifies the WSDL port element that corresponds to the
endpoint. The value for the <code>name</code> attribute takes the form
<em>portQName</em><code>.http-conduit</code>. For example, the code below shows
the <code>http-conf:conduit</code> element that would be used to add
configuration for an endpoint that was specified by the WSDL fragment
<code><port binding="widgetSOAPBinding" name="widgetSOAPPort></code> if
the endpoint's target namespace was <code><a shape="rect" class="external-link"
href="http://widgets.widgetvendor.net"
rel="nofollow">http://widgets.widgetvendor.net</a></code>. Alternatively, the
<code>name</code> attribute can be a regular expression to match a
URL. This allows configuration of conduits that are not used for purposes of
WSDL based endpoints such as JAX-RS and for WSDL retrieval.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>http-conf:conduit Element</b></div><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default">...
+<pre class="brush: java; gutter: false">...
<http-conf:conduit
name="{http://widgets/widgetvendor.net}widgetSOAPPort.http-conduit">
...
</http-conf:conduit>
@@ -291,7 +292,7 @@ http.setClient(httpClientPolicy);
...
</pre>
</div></div><p>The <code>http-conf:conduit</code> element has a number of
child elements that specify configuration information. They are described
below. See also Sun's <a shape="rect" class="external-link"
href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html"
rel="nofollow">JSSE Guide</a> for more information on configuring SSL.</p><div
class="table-wrap"><table class="wrapped confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p>Element</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:client</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the HTTP connection properties
such as timeouts, keep-alive requests, content types, etc.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:authorization</code></p></td><td
colspan="1" rowspan="1" class="confluenceT
d"><p>Specifies the the parameters for configuring the basic authentication
method that the endpoint uses preemptively.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>http-conf:proxyAuthorization</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters for
configuring basic authentication against outgoing HTTP proxy
servers.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:tlsClientParameters</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters used
to configure SSL/TLS.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>http-conf:authSupplier</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the bean reference or
class name of the object that supplies the authentication information used by
the endpoint both preemptively or in response to a 401 HTTP
challenge.</p></td></tr><tr><td colspan="1" rows
pan="1"
class="confluenceTd"><p><code>http-conf:trustDecider</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the bean reference or
class name of the object that checks the HTTP(S) URLConnection object in order
to establish trust for a connection with an HTTPS service provider before any
information is transmitted.</p></td></tr></tbody></table></div><h3
id="ClientHTTPTransport(includingSSLsupport)-Theclientelement">The
<code>client</code> element</h3><p>The <code>http-conf:client</code> element is
used to configure the non-security properties of a client's HTTP connection.
Its attributes, described below, specify the connection's properties.</p><div
class="table-wrap"><table class="wrapped confluenceTable"><colgroup
span="1"><col span="1"><col span="1"></colgroup><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td
colspan="1" rowspan="1" class
="confluenceTd"><p><code>ConnectionTimeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the amount of time, in
milliseconds, that the client will attempt to establish a connection before it
times out. The default is 30000 (30 seconds). <br clear="none"
class="atl-forced-newline">0 specifies that the client will continue to attempt
to open a connection indefinitely.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ReceiveTimeout</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the amount of time, in
milliseconds, that the client will wait for a response before it times out. The
default is 60000. <br clear="none" class="atl-forced-newline">0 specifies that
the client will wait indefinitely.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AutoRedirect</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies if the client will automatically
follow a server
issued redirection. The default is false.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>MaxRetransmits</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the maximum number of
times a client will retransmit a request to satisfy a redirect. The default is
-1 which specifies that unlimited retransmissions are
allowed.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AllowChunking</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether the client will send
requests using chunking. The default is true which specifies that the client
will use chunking when sending requests. <br clear="none"
class="atl-forced-newline">Chunking cannot be used if either of the following
are true:</p><ul><li><code>http-conf:basicAuthSupplier</code> is configured to
provide credentials preemptively.</li><li><code>AutoRedirect</code> is set to
true. <br clear="none" class="atl-forced-newline">In both
cases the value of <code>AllowChunking</code> is ignored and chunking is
disallowed. <br clear="none" class="atl-forced-newline">See note about chunking
below.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ChunkingThreshold</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the threshold at which CXF will
switch from non-chunking to chunking. By default, messages less than 4K are
buffered and sent non-chunked. Once this threshold is reached, the message is
chunked.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Accept</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies what media types the client is prepared to
handle. The value is used as the value of the HTTP <code>Accept</code>
property. The value of the attribute is specified using as multipurpose
internet mail extensions (MIME) types. See note about chunking
below.</p></td></tr><tr><td colspan="1" rowspan="1" class=
"confluenceTd"><p><code>AcceptLanguage</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies what language (for example,
American English) the client prefers for the purposes of receiving a response.
The value is used as the value of the HTTP AcceptLanguage property. <br
clear="none" class="atl-forced-newline">Language tags are regulated by the
International Organization for Standards (ISO) and are typically formed by
combining a language code, determined by the ISO-639 standard, and country
code, determined by the ISO-3166 standard, separated by a hyphen. For example,
en-US represents American English.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>AcceptEncoding</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies what content encodings the client
is prepared to handle. Content encoding labels are regulated by the Internet
Assigned Numbers Authority (IANA). The value is used as the value of the HTTP
<code>A
cceptEncoding</code> property.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ContentType</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the media type of the data being
sent in the body of a message. Media types are specified using multipurpose
internet mail extensions (MIME) types. The value is used as the value of the
HTTP <code>ContentType</code> property. The default is <code>text/xml</code>.
<br clear="none" class="atl-forced-newline"><strong>Tip:</strong> For web
services, this should be set to <code>text/xml</code>. If the client is sending
HTML form data to a CGI script, this should be set to
application/x-www-form-urlencoded. If the HTTP POST request is bound to a fixed
payload format (as opposed to SOAP), the content type is typically set to
application/octet-stream.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Host</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Spe
cifies the Internet host and port number of the resource on which the request
is being invoked. The value is used as the value of the HTTP <code>Host</code>
property. <br clear="none" class="atl-forced-newline"><strong>Tip:</strong>
This attribute is typically not required. It is only required by certain DNS
scenarios or application designs. For example, it indicates what host the
client prefers for clusters (that is, for virtual servers mapping to the same
Internet protocol (IP) address).</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Connection</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies whether a particular connection
is to be kept open or closed after each request/response dialog. There are two
valid values:</p><ul><li><code>Keep-Alive</code>(default) specifies that the
client wants to keep its connection open after the initial request/response
sequence. If the server honors it, the connection is kept open until the co
nsumer closes it.</li><li><code>close</code> specifies that the connection to
the server is closed after each request/response
sequence.</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CacheControl</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies directives about the behavior
that must be adhered to by caches involved in the chain comprising a request
from a client to a server.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Cookie</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Specifies a static cookie to be sent with all
requests.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>BrowserType</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies information about the browser
from which the request originates. In the HTTP specification from the World
Wide Web consortium (W3C) this is also known as the <em>user-agent</em>. Some se
rvers optimize based upon the client that is sending the
request.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>Referer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of the resource that
directed the consumer to make requests on a particular service. The value is
used as the value of the HTTP Referer property. <br clear="none"
class="atl-forced-newline"><strong>Note:</strong> This HTTP property is used
when a request is the result of a browser user clicking on a hyperlink rather
than typing a URL. This can allow the server to optimize processing based upon
previous task flow, and to generate lists of back-links to resources for the
purposes of logging, optimized caching, tracing of obsolete or mistyped links,
and so on. However, it is typically not used in web services applications. <br
clear="none" class="atl-forced-newline"><strong>Important:</strong> If the
AutoRedirect attribute is set to true and the request is
redirected, any value specified in the Refererattribute is overridden. The
value of the HTTP Referer property will be set to the URL of the service who
redirected the consumer's original request.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>DecoupledEndpoint</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the URL of a
decoupled endpoint for the receipt of responses over a separate
server->client connection. <br clear="none"
class="atl-forced-newline"><strong>Warning:</strong> You must configure both
the client and server to use WS-Addressing for the decoupled endpoint to
work.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServer</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Specifies the URL of the proxy server
through which requests are routed.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>ProxyServerPort</code></p></td><td colspan="1" r
owspan="1" class="confluenceTd"><p>Specifies the port number of the proxy
server through which requests are routed.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd">NonProxyHosts</td><td colspan="1" rowspan="1"
class="confluenceTd">Specifies a list of hosts that should be directly routed.
This value is a list of patterns separated by '|', where each pattern may start
or end with a '*' for wildcard matching.</td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>ProxyServerType</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the type of proxy
server used to route requests. Valid values
are:</p><ul><li>HTTP(default)</li><li>SOCKS</li></ul></td></tr></tbody></table></div><h4
id="ClientHTTPTransport(includingSSLsupport)-ExampleusingtheClientElement">Example
using the <code>Client</code> Element</h4><p>The example below shows a the
configuration for an HTTP client that wants to keep its connection to the
server open between re
quests, will only retransmit requests once per invocation, and cannot use
chunking streams.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>HTTP Consumer Endpoint Configuration</b></div><div class="codeContent
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"><beans
xmlns="http://www.springframework.org/schema/beans"
+<pre class="brush: java; gutter: false"><beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
@@ -307,11 +308,11 @@ http.setClient(httpClientPolicy);
</beans>
</pre>
</div></div><p>Again, see the <a shape="rect"
href="configuration.html">Configuration page</a> for information on how to get
CXF to detect your configuration file.</p><h3
id="ClientHTTPTransport(includingSSLsupport)-ThetlsClientParameterselement">The
<code>tlsClientParameters</code> element</h3><p>Please see <a shape="rect"
href="tls-configuration.html">TLS Configuration</a> page for more
information.</p><h2
id="ClientHTTPTransport(includingSSLsupport)-UsingWSDL">Using WSDL</h2><h3
id="ClientHTTPTransport(includingSSLsupport)-Namespace.1">Namespace</h3><p>The
WSDL extension elements used to configure an HTTP client are defined in the
namespace <code><a shape="rect"
href="http://cxf.apache.org/transports/http/configuration">http://cxf.apache.org/transports/http/configuration</a></code>.
It is commonly referred to using the prefix <code>http-conf</code>. In order
to use the HTTP configuration elements you will need to add the line shown
below to the <code>definitions</code> element of
your endpoint's WSDL document.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>HTTP Consumer WSDL Element's
Namespace</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"><definitions ...
+<pre class="brush: java; gutter: false"><definitions ...
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration
</pre>
</div></div><h3
id="ClientHTTPTransport(includingSSLsupport)-Theclientelement.1">The
<code>client</code> element</h3><p>The <code>http-conf:client</code> element is
used to specify the connection properties of an HTTP client in a WSDL document.
The <code>http-conf:client</code> element is a child of the WSDL
<code>port</code> element. It has the same attributes as the
<code>client</code> element used in the configuration file.</p><h3
id="ClientHTTPTransport(includingSSLsupport)-Example">Example</h3><p>The
example below shows a WSDL fragment that configures an HTTP client to specify
that it will not interact with caches.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>WSDL to Configure an HTTP Consumer
Endpoint</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"><service ...>
+<pre class="brush: java; gutter: false"><service ...>
<port ...>
<soap:address ... />
<http-conf:client CacheControl="no-cache" />
@@ -319,7 +320,7 @@ http.setClient(httpClientPolicy);
</service>
</pre>
</div></div><h2
id="ClientHTTPTransport(includingSSLsupport)-Usingjavacode">Using java
code</h2><h3
id="ClientHTTPTransport(includingSSLsupport)-HowtoconfiguretheHTTPConduitfortheSOAPClient?">How
to configure the HTTPConduit for the SOAP Client?</h3><p>First you need get
the <a shape="rect" class="external-link" href="http://tinyurl.com/285zll"
rel="nofollow">HTTPConduit</a> from the Proxy object or Client, then you can
set the <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/blob/master/rt/transports/http/src/main/resources/schemas/configuration/http-conf.xsd"
rel="nofollow">HTTPClientPolicy</a>, AuthorizationPolicy,
ProxyAuthorizationPolicy, <a shape="rect" class="external-link"
href="https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/configuration/jsse/TLSParameterBase.java"
rel="nofollow">TLSClientParameters.</a></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.endpoint.Client;
+<pre class="brush: java; gutter: false"> import
org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
@@ -346,7 +347,7 @@ http.setClient(httpClientPolicy);
greeter.sayHi("Hello");
</pre>
</div></div><h3
id="ClientHTTPTransport(includingSSLsupport)-HowtouseHTTPConduitConfigurer?">How
to use HTTPConduitConfigurer?</h3><p>In certain cases, the HTTPConduit could
be recreated (for example when using the FailoverFeature) and therefore losing
the preconfigured policies. To overcome that, the HTTPConduitConfigurer has
been introduced. Here is an example of how it could be used.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> HTTPConduitConfigurer
httpConduitConfigurer = new HTTPConduitConfigurer() {
+<pre class="brush: java; gutter: false"> HTTPConduitConfigurer
httpConduitConfigurer = new HTTPConduitConfigurer() {
public void configure(String name, String address, HTTPConduit c) {
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
@@ -361,7 +362,7 @@ http.setClient(httpClientPolicy);
bus.setExtension(httpConduitConfigurer, HTTPConduitConfigurer.class);
</pre>
</div></div><p class="code-java"><br clear="none"></p><h3
id="ClientHTTPTransport(includingSSLsupport)-Howtooverridetheserviceaddress?">How
to override the service address ?</h3><p>If you are using JAXWS API to create
the proxy obejct, here is an example which is complete JAX-WS compliant
code</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> URL wsdlURL =
MyService.class.getClassLoader
+<pre class="brush: java; gutter: false"> URL wsdlURL =
MyService.class.getClassLoader
.getResource ("myService.wsdl");
QName serviceName = new QName("urn:myService", "MyService");
MyService service = new MyService(wsdlURL, serviceName);
@@ -374,7 +375,7 @@ bus.setExtension(httpConduitConfigurer,
</pre>
</div></div><p>If you are using CXF ProxyFactoryBean to create the proxy
object , you can do 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">
+<pre class="brush: java; gutter: false">
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
poxyFactory.setServiceClass(ServicePort.class);
// you could set the service address with this method
@@ -382,7 +383,7 @@ bus.setExtension(httpConduitConfigurer,
ServicePort client = (ServicePort) proxyFactory.create();
</pre>
</div></div><p>Here is another way which takes advantage of JAXWS's
Service.addPort() API</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"> URL wsdlURL =
MyService.class.getClassLoader.getResource("service2.wsdl");
+<pre class="brush: java; gutter: false"> URL wsdlURL =
MyService.class.getClassLoader.getResource("service2.wsdl");
QName serviceName = new QName("urn:service2", "MyService");
QName portName = new QName("urn:service2", "ServicePort");
MyService service = new MyService(wsdlURL, serviceName);