<?xml version="1.0" encoding="UTF-8"?>
<!--
 - Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
 - 
 - Licensed 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.
 -->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="urn:switchyard-component-http:config:1.0"
        xmlns:http="urn:switchyard-component-http:config:1.0"
        xmlns:swyd="urn:switchyard-config:switchyard:1.0"
        xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
        elementFormDefault="qualified">

    <import namespace="urn:switchyard-config:switchyard:1.0"/>
    <import namespace="http://docs.oasis-open.org/ns/opencsa/sca/200912"/>

    <element name="binding.http" type="http:HTTPBindingType" substitutionGroup="swyd:binding.switchyard"/>
    <complexType name="HTTPBindingType">
        <complexContent>
            <extension base="swyd:SwitchYardBindingType">
                <sequence>
                    <element name="contextMapper" type="swyd:ContextMapperType"  minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Specify the ContextMapper to be used.</documentation>
                        </annotation>
                    </element>
                    <element name="messageComposer" type="swyd:MessageComposerType" minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Specify the MessageComposer to be used.</documentation>
                        </annotation>
                    </element>
                    <choice>
                        <sequence>
                            <element name="contextPath" type="string" minOccurs="0" maxOccurs="1">
                                <annotation>
                                    <documentation>A context path where the HTTP endpoint will be exposed for Service bindings.</documentation>
                                </annotation>
                            </element>
                        </sequence>
                        <sequence>
                            <element name="address" type="string" minOccurs="0" maxOccurs="1">
                                <annotation>
                                    <documentation>A URL that points to the HTTP endpoint in case of Reference bindings.</documentation>
                                </annotation>
                            </element>
                            <element name="method" type="string" minOccurs="0" maxOccurs="1">
                                <annotation>
                                    <documentation>The HTTP method.</documentation>
                                </annotation>
                            </element>
                            <element name="contentType" type="string" minOccurs="0" maxOccurs="1">
                                <annotation>
                                    <documentation>The HTTP request's content-type header that need to be set.</documentation>
                                </annotation>
                            </element>
                            <choice>
                                <element name="basic" type="http:BasicAuthenticationType" minOccurs="0" maxOccurs="1"/>
                                <element name="ntlm" type="http:NTLMAuthenticationType" minOccurs="0" maxOccurs="1"/>
                            </choice>
                            <element name="proxy" type="http:ProxyType" minOccurs="0" maxOccurs="1">
                                <annotation>
                                    <documentation>Http proxy settings.</documentation>
                                </annotation>
                            </element>
                        </sequence>
                    </choice>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="BasicAuthenticationType">
        <complexContent>
            <extension base="sca:CommonExtensionBase">
                <sequence>
                    <element name="user" type="string" maxOccurs="1">
                        <annotation>
                            <documentation>User name.</documentation>
                        </annotation>
                    </element>
                    <element name="password" type="string" maxOccurs="1">
                        <annotation>
                            <documentation>Password.</documentation>
                        </annotation>
                    </element>
                    <element name="realm" type="string" minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Authentication Realm.</documentation>
                        </annotation>
                    </element>
                    <element name="host" type="string" minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Authentication Host.</documentation>
                        </annotation>
                    </element>
                    <element name="port" type="integer" minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Authentication Port.</documentation>
                        </annotation>
                    </element>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="NTLMAuthenticationType">
        <complexContent>
            <extension base="http:BasicAuthenticationType">
                <sequence>
                    <element name="domain" type="string" maxOccurs="1">
                        <annotation>
                            <documentation>The NTLM Domain.</documentation>
                        </annotation>
                    </element>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="ProxyType">
        <complexContent>
            <extension base="sca:CommonExtensionBase">
                <sequence>
                    <element name="host" type="string" minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Proxy Host.</documentation>
                        </annotation>
                    </element>
                    <element name="port" type="integer" minOccurs="0" maxOccurs="1">
                        <annotation>
                            <documentation>Proxy Port.</documentation>
                        </annotation>
                    </element>
                    <element name="user" type="string" maxOccurs="1">
                        <annotation>
                            <documentation>Proxy user name.</documentation>
                        </annotation>
                    </element>
                    <element name="password" type="string" maxOccurs="1">
                        <annotation>
                            <documentation>Proxy password.</documentation>
                        </annotation>
                    </element>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
</schema>
