blob: 4e7c54c6b7ad68c21a98b4d8326197656c8a6077 [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 - Server HTTP Transport">
<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/shBrushBash.js'></script>
<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
<script>
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
<title>
Apache CXF -- Server HTTP Transport
</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="transports.html">Transports</a>&nbsp;&gt;&nbsp;<a href="http-transport.html">HTTP Transport</a>&nbsp;&gt;&nbsp;<a href="server-http-transport.html">Server HTTP Transport</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"><h1 id="ServerHTTPTransport-ServerHTTPTransport">Server HTTP Transport</h1><p>HTTP server endpoints can specify a number of HTTP connection attributes including if it will honor keep alive requests, how it interacts with caches, and how tolerant it is of errors in communicating with a consumer.</p><p>A server endpoint can be configured using two mechanisms:</p><ul><li>Configuration</li><li>WSDL</li></ul><h2 id="ServerHTTPTransport-UsingConfiguration">Using Configuration</h2><h3 id="ServerHTTPTransport-Namespace">Namespace</h3><p>The elements used to configure an HTTP provider endpoint 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 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>Adding the Configuration Namespace</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;beans ...
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration
...
xsi:schemaLocation="...
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
..."&gt;
</pre>
</div></div><h3 id="ServerHTTPTransport-Thedestinationelement">The <code>destination</code> element</h3><p>You configure an HTTP server endpoint using the <code>http-conf:destination</code> element and its children. The <code>http-conf:destination</code> element takes a single attribute, <code>name</code>, the 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-destination</code>. The example below shows the <code>http-conf:destination</code> element that would be used to add configuration for an endpoint that was specified by the WSDL fragment <code>&lt;port binding="widgetSOAPBinding" name="widgetSOAPPort&gt;</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>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>http-conf:destination Element</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">...
&lt;http-conf:destination name="{http://widgets/widgetvendor.net}widgetSOAPPort.http-destination"&gt;
...
&lt;/http-conf:destination&gt;
...
</pre>
</div></div><p>The <code>http-conf:destination</code> element has a number of child elements that specify configuration information. They are described below.</p><div class="table-wrap"><table class="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:server</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the HTTP connection properties.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>http-conf:contextMatchStrategy</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the parameters that configure the context match strategy for processing HTTP requests.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>http-conf:fixedParameterOrder</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether the parameter order of an HTTP request handled by this destination is fixed.</p></td></tr></tbody></table></div><h3 id="ServerHTTPTransport-Theserverelement">The <code>server</code> element</h3><p>The <code>http-conf:server</code> element is used to configure the properties of a server's HTTP connection. Its attributes, described below, specify the connection's properties.</p><div class="table-wrap"><table class="confluenceTable"><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>ReceiveTimeout</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the length of time, in milliseconds, the server tries to receive a request before the connection times out. The default is 30000. Use 0 to specify that the server will not timeout.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>SuppressClientSendErrors</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether exceptions are to be thrown when an error is encountered on receiving a request. The default is <code>false</code>; exceptions are thrown on encountering errors.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>SuppressClientReceiveErrors</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether exceptions are to be thrown when an error is encountered on sending a response to a client. The default is <code>false</code>; exceptions are thrown on encountering errors.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>HonorKeepAlive</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies whether the server honors requests for a connection to remain open after a response has been sent. The default is <code>true</code>; keep-alive requests are honored.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>RedirectURL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies the URL to which the client request should be redirected if the URL specified in the client request is no longer appropriate for the requested resource. In this case, if a status code is not automatically set in the first line of the server response, the status code is set to 302 and the status description is set to Object Moved. The value is used as the value of the HTTP <code>RedirectURL</code> property.</p></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 response from a server to a client.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ContentLocation</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the URL where the resource being sent in a response is located.</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 information being sent in a response. Media types are specified using multipurpose internet mail extensions (MIME) types. The value is used as the value of the HTTP <code>ContentType</code> location.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ContentEncoding</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies any additional content encodings that have been applied to the information being sent by the service provider. Content encoding labels are regulated by the Internet Assigned Numbers Authority (IANA). Possible content encoding values include zip, gzip, compress, deflate, and identity. This value is used as the value of the HTTP <code>ContentEncoding</code> property.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ServerType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies what type of server is sending the response. Values take the form program-name/version. For example, Apache/1.2.5.</p></td></tr></tbody></table></div><h3 id="ServerHTTPTransport-Example">Example</h3><p>The example below shows a the configuration for an HTTP service provider endpoint that honors keep alive requests and suppresses all communication errors.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>HTTP Service Provider Endpoint Configuration</b></div><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:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
&lt;http-conf:destination
name="{http://apache.org/hello_world_soap_http}SoapPort.http-destination"&gt;
&lt;http-conf:server SuppressClientSendErrors="true"
SuppressClientReceiveErrors="true"
HonorKeepAlive="true" /&gt;
&lt;/http-conf:destination&gt;
&lt;/beans&gt;
</pre>
</div></div><h2 id="ServerHTTPTransport-UsingWSDL">Using WSDL</h2><h3 id="ServerHTTPTransport-Namespace.1">Namespace</h3><p>The WSDL extension elements used to configure an HTTP server endpoint 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 refered 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 Provider WSDL Element's Namespace</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;definitions ...
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration
</pre>
</div></div><h3 id="ServerHTTPTransport-Theserverelement.1">The <code>server</code> element</h3><p>The <code>http-conf:server</code> element is used to specify the connection properties of an HTTP server in a WSDL document. The <code>http-conf:server</code> element is a child of the WSDL port element. It has the same attributes as the <code>server</code> element used in the configuration file.</p><h3 id="ServerHTTPTransport-Example.1">Example</h3><p>The example below shows a WSDL fragment that configures an HTTP server endpoint 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 Service Provider Endpoint</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default">&lt;service ...&gt;
&lt;port ...&gt;
&lt;soap:address ... /&gt;
&lt;http-conf:server CacheControl="no-cache" /&gt;
&lt;/port&gt;
&lt;/service&gt;
</pre>
</div></div><h2 id="ServerHTTPTransport-ServerCacheControlDirectives">Server Cache Control Directives</h2><p>The table below lists the cache control directives supported by an HTTP server.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Directive</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Behavior</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>no-cache</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Caches cannot use a particular response to satisfy subsequent requests without first revalidating that response with the server. If specific response header fields are specified with this value, the restriction applies only to those header fields within the response. If no response header fields are specified, the restriction applies to the entire response.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>public</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Any cache can store the response.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>private</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Public (shared) caches cannot store the response because the response is intended for a single user. If specific response header fields are specified with this value, the restriction applies only to those header fields within the response. If no response header fields are specified, the restriction applies to the entire response.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>no-store</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Caches must not store any part of response or any part of the request that invoked it.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>no-transform</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Caches must not modify the media type or location of the content in a response between a server and a client.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>must-revalidate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Caches must revaildate expired entries that relate to a response before that entry can be used in a subsequent response.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>proxy-revalidate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Means the same as must-revalidate, except that it can only be enforced on shared caches and is ignored by private unshared caches. If using this directive, the public cache directive must also be used.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>max-age</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Clients can accept a response whose age is no greater that the specified number of seconds.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>s-max-age</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Means the same as max-age, except that it can only be enforced on shared caches and is ignored by private unshared caches. The age specified by s-max-age overrides the age specified by max-age. If using this directive, the proxy-revalidate directive must also be used.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cache-extension</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies additional extensions to the other cache directives. Extensions might be informational or behavioral. An extended directive is specified in the context of a standard directive, so that applications not understanding the extended directive can at least adhere to the behavior mandated by the standard directive.</p></td></tr></tbody></table></div></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=60558">edit page</a>)
(<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=60558&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>