<?xml version="1.0" encoding="UTF-8"?>
<!--
  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.
-->

<xs:schema targetNamespace="http://cxf.apache.org/transports/http/configuration" 
           xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           elementFormDefault="qualified" 
           attributeFormDefault="unqualified"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           jaxb:version="2.0">

    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/" 
        schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd"/>
    
    <xs:element name="server" type="http-conf:HTTPServerPolicy"/>
    <xs:element name="client" type="http-conf:HTTPClientPolicy"/>
    <xs:element name="contextMatchStrategy" type="xs:string" default="stem"/>
    <xs:element name="fixedParameterOrder"  type="xs:boolean" default="false"/>
    
    <xs:complexType name="HTTPServerPolicy">
        <xs:annotation>
            <xs:documentation>Properties used for configuring a server-side HTTP prort</xs:documentation>
        </xs:annotation>

        <xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">

                <xs:attribute name="ReceiveTimeout" type="xs:unsignedInt" use="optional" default="30000">
                    <xs:annotation>
                        <xs:documentation>
                        Receive timeout in milliseconds, 0 is infinite
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="SuppressClientSendErrors" type="xs:boolean" use="optional" default="false">
                    <xs:annotation>
                        <xs:documentation>
                        When set to false, exceptions will be thrown when an error is encountered 
                        receiving a request from the client.  When set to true these errors will 
                        be suppressed. The default is false.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="SuppressClientReceiveErrors" type="xs:boolean" use="optional" default="false">
                    <xs:annotation>
                        <xs:documentation>
                        When set to false, exceptions will be thrown when an error is encountered 
                        sending a reply from to client.  When set to true these errors will be 
                        suppressed. The default is false.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="HonorKeepAlive" type="xs:boolean" use="optional" default="true">
                    <xs:annotation>
                        <xs:documentation>
                        When set to true, the request socket will remain open after the reply is 
                        sent to the client, if the client has requested keep-alive and is using 
                        at least version 1.1 of HTTP.  If set to false, the socket will be closed 
                        after each reply is sent, even if the client requests the server to keep 
                        the connection alive.  Keep-Alive improves performance for the client 
                        requesting such behavior, but can limit overall scalability of the server 
                        for handling many clients. The Default is false.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="RedirectURL" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        A URL to which clients are redirected (if the ReplyCode and ReplyDescription 
                        are not set, ReplyCode will be set to 302, and  ReplyDescription will be set 
                        to 'Object Moved').
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="CacheControl" type="http-conf:serverCacheControlType" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Most commonly used to specify no-cache, however the standard supports a 
                        dozen or so caching related directives for responses. 
                        </xs:documentation>
                    </xs:annotation>      

                </xs:attribute>

                <xs:attribute name="ContentLocation" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the URL representing the resource used to satisfy the request(e.g., to inform that default.htm document was used.)
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="ContentType" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the MIME type used for responses.  The default is set by the binding.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="ContentEncoding" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies any additional encoding applied to the response. Values are specified using IANA labels.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="ServerType" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies an optional value for the HTTP ServerType property.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="HTTPClientPolicy">
        <xs:annotation>
            <xs:documentation>Properties used to configure a client-side HTTP port</xs:documentation>
        </xs:annotation>

        <xs:complexContent>
            <xs:extension base="wsdl:tExtensibilityElement">

                <xs:attribute name="ConnectionTimeout" type="xs:unsignedInt" use="optional" default="30000">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the amount of time, in milliseconds, that the consumer will attempt to establish a connection before it times out. 0 is infinite.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="ReceiveTimeout" type="xs:unsignedInt" use="optional" default="60000">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the amount of time, in milliseconds, that the consumer will wait for a response before it times out. 0 is infinite.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="AutoRedirect" type="xs:boolean" use="optional" default="false">
                    <xs:annotation>
                        <xs:documentation>
                       Specifies if the consumer will automatically follow a server issued redirection.
                        (name is not part of standard)
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="MaxRetransmits" type="xs:int" use="optional" default="-1">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the maximum amount of retransmits that are allowed for redirects. Retransmits for 
                        authorization is included in the retransmit count. Each redirect may cause another 
                        retransmit for a UNAUTHORIZED response code, ie. 401. 
                        Any negative number indicates unlimited retransmits,
                        although, loop protection is provided. 
                        The default is unlimited. 
                        (name is not part of standard)
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="AllowChunking" type="xs:boolean" use="optional" default="true">
                    <xs:annotation>
                        <xs:documentation>
                        If true, the client is free to use chunking streams if it wants, but it is not 
                        required to use chunking streams. If false, the client 
                        must use regular, non-chunked requests in all cases.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>
                <xs:attribute name="ChunkingThreshold" type="xs:int" use="optional" default="4096">
                    <xs:annotation>
                        <xs:documentation>
                        If AllowChunking is true, this sets the threshold at which messages start
                        getting chunked. Messages under this limit do not get chunked.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="Accept" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the MIME types the client is prepared to handle (e.g., HTML, JPEG, GIF, etc.)
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="AcceptLanguage" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the language the client desires (e.g., English, French, etc.)
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="AcceptEncoding" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the encoding the client is prepared to handle (e.g., gzip)
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="ContentType" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the content type of the stream being sent in a post request. 
                        (this should be text/xml for web services, or can be set to 
                        application/x-www-form-urlencoded if the client is sending form data).
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="Host" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the Internet host and port number of the resource on which the request is being invoked.
                        This is sent by default based upon the URL. Certain DNS scenarios or
                        application designs may request you to set this, but typically it is
                        not required.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="Connection" type="http-conf:connectionType" use="optional" default="Keep-Alive">
                    <xs:annotation>
                        <xs:documentation>
                        The connection disposition. If close the connection to the server is closed 
                        after each request/response dialog. If Keep-Alive the client requests the server 
                        to keep the connection open, and if the server honors the keep alive request, 
                        the connection is reused. Many servers and proxies do not honor keep-alive requests.
                        </xs:documentation>
                    </xs:annotation>      

                </xs:attribute>

                <xs:attribute name="CacheControl" type="http-conf:clientCacheControlType" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Most commonly used to specify no-cache, however the standard supports a 
                        dozen or so caching related directives for requests 
                        </xs:documentation>
                    </xs:annotation>      

                </xs:attribute>

                <xs:attribute name="Cookie" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies a cookie to send to the server. Some stateful session designs will use cookies to identify a session.
                        If the cookie is static, you can supply it here. If it is dynamic,
                        it will need to be set by the server on first access, and can be handled
                        automatically by the runtime.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="BrowserType" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        aka User-Agent
                        Specifies the type of browser is sending the request. This is usually only 
                        needed when sites have HTML customized to Netscape vs IE, etc, but can
                        also be used to optimize for different SOAP stacks.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="Referer" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the URL that referred us to this URL. This is 
                        sent automatically with auto redirect.

                        May allow the server to optimize processing based upon
                        previous task flow.  However, typically not used in 
                        web services applications.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <xs:attribute name="DecoupledEndpoint" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the URL of a decoupled endpoint for the receipt of responses over a separate provider-&gt;consumer connection.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>

                <!--Proxy server attributes-->
                <xs:attribute name="ProxyServer" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the address of proxy server if one is used.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>
                <xs:attribute name="ProxyServerPort" type="xs:int" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the port number used by the proxy server.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>
                <xs:attribute name="ProxyServerType" type="http-conf:proxyServerType" use="optional" default="HTTP">
                    <xs:annotation>
                        <xs:documentation>
                        Specifies the ype of the proxy server. Can be either HTTP or SOCKS.
                        </xs:documentation>
                    </xs:annotation>      
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    
    <xs:simpleType name="serverCacheControlType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="no-cache"/>
            <xs:enumeration value="public"/>
            <xs:enumeration value="private"/>
            <xs:enumeration value="no-store"/>
            <xs:enumeration value="no-transform"/>
            <xs:enumeration value="must-revalidate"/>
            <xs:enumeration value="proxy-revalidate"/>
            <xs:enumeration value="max-age"/>
            <xs:enumeration value="s-max-age"/>
            <xs:enumeration value="cache-extension"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="clientCacheControlType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="no-cache"/>
            <xs:enumeration value="no-store"/>
            <xs:enumeration value="max-age"/>
            <xs:enumeration value="max-stale"/>
            <xs:enumeration value="min-fresh"/>
            <xs:enumeration value="no-transform"/>
            <xs:enumeration value="only-if-cached"/>
            <xs:enumeration value="cache-extension"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="connectionType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="close"/>
            <xs:enumeration value="Keep-Alive"/>
        </xs:restriction>
    </xs:simpleType>
    
    <xs:simpleType name="proxyServerType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="HTTP"/>
            <xs:enumeration value="SOCKS"/>
        </xs:restriction>
    </xs:simpleType>
 </xs:schema>
