<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://oss.oracle.com/licenses/CDDL+GPL-1.1
    or LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<!--
  XML Schema for external mapping metadata for the JAX-WS RI & JSR-181.
  The data is used to define the attributes of a particular Java Web Service
  endpoint.

     Corresponding Java annotation: javax.jws.WebParam.Mode


 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://xmlns.oracle.com/webservices/jaxws-databinding"
           xmlns="http://xmlns.oracle.com/webservices/jaxws-databinding"
           elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">

    <xs:element name="java-wsdl-mapping" type="java-wsdl-mapping-type">
        <xs:annotation>
            <xs:documentation>
                The top-level element is the Web Service end-point being defined.

                attributes:
                java-type-name: the SEI class these definitions apply to
                databinding: the databinding module to use, such as
                "glassfish.jaxb", "toplink.jaxb", "toplink.sdo".
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:complexType name="java-wsdl-mapping-type">
        <xs:sequence>
            <xs:element name="xml-schema-mapping" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        The xml-schema-mapping element points to the
                        external JAXB annotations for the value types
                        that occur in an SEI. This mapping element can
                        either be defined externally and referenced via a
                        URI, or embedded as an XML fragment within the
                        current instance end-point definition document.
                    </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:any minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:group ref="class-annotation" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        The class-annotation group defines the set of
                        annotations applicable to the Java class
                        declaration.
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
            <xs:element name="java-methods" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Each java method in the SEI may use the external
                        metadata defined in this schema in addition to or
                        in lieu of the standard JAX-WS annotations.
                    </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="java-method" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="optional"/>
        <xs:attribute name="java-type-name" type="xs:string" use="optional"/>
        <xs:attribute name="existing-annotations" type="existing-annotations-type" use="optional"/>
        <xs:attribute name="databinding" type="xs:string" use="optional"/>
        <xs:anyAttribute namespace="##other" processContents="skip"/>
    </xs:complexType>

    <xs:group name="class-annotation">
        <xs:annotation>
            <xs:documentation>
                The class-annotation group defines the set of annotations
                that may be applied to a class declaration.
            </xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:any namespace="##other" processContents="skip"/>
            <xs:element ref="web-service" minOccurs="0"/>
            <xs:element ref="soap-binding" minOccurs="0"/>
            <xs:element ref="binding-type" minOccurs="0"/>
            <xs:element ref="mtom" minOccurs="0"/>
            <xs:element ref="handler-chain" minOccurs="0"/>
            <xs:element ref="service-mode" minOccurs="0"/>
            <xs:element ref="web-fault" minOccurs="0"/>
            <xs:element ref="web-service-client" minOccurs="0"/>
            <xs:element ref="addressing" minOccurs="0"/>
        </xs:choice>
    </xs:group>

    <xs:element name="java-method">
        <xs:annotation>
            <xs:documentation>
                The java-method element defines a set of annotations that may
                be applied to a method and its parameters.
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>
            <xs:sequence>
                <xs:group ref="method-annotation" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="java-params" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Each Java parameter may have the annotations
                            defined by the java-param element.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element ref="java-param" maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The name parameter corresponds to the Java name of
                        the method to which the annotations apply.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:anyAttribute namespace="##other" processContents="skip"/>
        </xs:complexType>
    </xs:element>

    <xs:group name="method-annotation">
        <xs:annotation>
            <xs:documentation>
                The method-annotation group defines the set of
                annotations applicable to a defined method in the SEI.
            </xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:any namespace="##other" processContents="skip"/>
            <xs:element ref="web-method" minOccurs="0"/>
            <xs:element ref="web-result" minOccurs="0"/>
            <xs:element ref="oneway" minOccurs="0"/>
            <xs:element ref="soap-binding" minOccurs="0"/>
            <xs:element ref="action" minOccurs="0"/>
            <xs:element ref="web-endpoint" minOccurs="0"/>
        </xs:choice>
    </xs:group>

    <xs:element name="java-param">
        <xs:annotation>
            <xs:documentation>
                The java-param element contains the group of JAX-WS parameter
                annotations, plus optionally binds a specific Java type
                mapping to the parameter. The set of applicable attributes is
                not specifically enumerated.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:group ref="param-annotation" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="java-type" type="xs:string" use="optional"/>
            <xs:anyAttribute namespace="##other" processContents="skip"/>
        </xs:complexType>
    </xs:element>

    <xs:group name="param-annotation">
        <xs:annotation>
            <xs:documentation>
                The param-annotation defines the annotations applied to an
                individual parameter. Theses consist of the JAX-WS standard
                WebParam plus others to be defined.
            </xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:any namespace="##other" processContents="skip"/>
            <xs:element ref="web-param" minOccurs="0"/>
        </xs:choice>
    </xs:group>

    <xs:simpleType name="web-param-mode">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.WebParam.Mode (Enum)
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="IN"/>
            <xs:enumeration value="OUT"/>
            <xs:enumeration value="INOUT"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="web-service">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.WebService
                @Target(value=TYPE)
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="endpoint-interface" type="xs:string" default=""/>
            <xs:attribute name="name" type="xs:string" default=""/>
            <xs:attribute name="port-name" type="xs:string" default=""/>
            <xs:attribute name="service-name" type="xs:string" default=""/>
            <xs:attribute name="target-namespace" type="xs:string" default=""/>
            <xs:attribute name="wsdl-location" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-param">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.WebParam
                @Target(value={PARAMETER}
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="header" type="xs:boolean" default="false"/>
            <xs:attribute name="mode" type="web-param-mode" default="IN"/>
            <xs:attribute name="name" type="xs:string" default=""/>
            <xs:attribute name="part-name" type="xs:string" default=""/>
            <xs:attribute name="target-namespace" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <!--
       The following elements may be applied to a method:
       @Target(value={METHOD})
    -->
    <xs:element name="oneway">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.Oneway
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-method">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.WebMethod
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="action" type="xs:string" default=""/>
            <xs:attribute name="exclude" type="xs:boolean" default="false"/>
            <xs:attribute name="operation-name" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-result">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.WebResult
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="header" type="xs:boolean" default="false"/>
            <xs:attribute name="name" type="xs:string" default=""/>
            <xs:attribute name="part-name" type="xs:string" default=""/>
            <xs:attribute name="target-namespace" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>


    <!--
        The following types correspond to JAX-WS Enums
    -->
    <xs:simpleType name="soap-binding-style">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.soap.SOAPBinding.Style
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="DOCUMENT"/>
            <xs:enumeration value="RPC"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="soap-binding-use">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.soap.SOAPBinding.Use
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="LITERAL"/>
            <xs:enumeration value="ENCODED"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="soap-binding-parameter-style">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation:
                javax.jws.soap.SOAPBinding.ParameterStyle
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="BARE"/>
            <xs:enumeration value="WRAPPED"/>
        </xs:restriction>
    </xs:simpleType>

    <!--
        The following apply to types and in some cases methods.
     -->
    <xs:element name="soap-binding">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.soap.SOAPBinding
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="style" type="soap-binding-style" default="DOCUMENT"/>
            <xs:attribute name="use" type="soap-binding-use" default="LITERAL"/>
            <xs:attribute name="parameter-style" type="soap-binding-parameter-style" default="WRAPPED"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="binding-type">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.BindingType
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="value" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="request-wrapper">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.RequestWrapper
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="local-name" type="xs:string" default=""/>
            <xs:attribute name="target-namespace" type="xs:string" default=""/>
            <xs:attribute name="class-name" type="xs:string" default=""/>
            <xs:attribute name="part-name" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="response-wrapper">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.ResponseWrapper
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="local-name" type="xs:string" default=""/>
            <xs:attribute name="target-namespace" type="xs:string" default=""/>
            <xs:attribute name="class-name" type="xs:string" default=""/>
            <xs:attribute name="part-name" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="action">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.Action
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="fault-action" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="input" type="xs:string" default=""/>
            <xs:attribute name="output" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="fault-action">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.FaultAction
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="className" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" default=""/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mtom">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.soap.MTOM
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="enabled" type="xs:boolean" default="true"/>
            <xs:attribute name="threshold" type="xs:int" default="0"/>
        </xs:complexType>
    </xs:element>


    <xs:element name="handler-chain">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.jws.HandlerChain
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="file" type="xs:string"/>
            <!--deprecated: -->
            <!--<xs:attribute name="name" type="xs:string" default=""/>-->
        </xs:complexType>
    </xs:element>

    <xs:element name="service-mode">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.ServiceMode
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="value" type="xs:string" default="PAYLOAD"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-endpoint">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.WebEndpoint
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-fault">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.WebFault
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="targetNamespace" type="xs:string"/>
            <xs:attribute name="faultBean" type="xs:string"/>
            <xs:attribute name="messageName" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-service-client">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.WebServiceClient
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="targetNamespace" type="xs:string"/>
            <xs:attribute name="wsdlLocation" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-service-provider">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.WebServiceProvider
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="targetNamespace" type="xs:string"/>
            <xs:attribute name="serviceName" type="xs:string"/>
            <xs:attribute name="portName" type="xs:string"/>
            <xs:attribute name="wsdlLocation" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="web-service-ref">
        <xs:annotation>
            <xs:documentation>
                Corresponding Java annotation: javax.xml.ws.WebServiceRef
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string"/>
            <xs:attribute name="type" type="xs:string"/>
            <xs:attribute name="mappedName" type="xs:string"/>
            <xs:attribute name="value" type="xs:string"/>
            <xs:attribute name="wsdlLocation" type="xs:string"/>
            <xs:attribute name="lookup" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="addressing">
        <xs:annotation>
            <xs:documentation>Corresponding Java annotation: javax.xml.ws.soap.Addressing</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="enabled" type="xs:boolean" default="true"/>
            <xs:attribute name="required" type="xs:boolean" default="false"/>
        </xs:complexType>
    </xs:element>

    <xs:simpleType name="existing-annotations-type">
        <xs:restriction base="xs:string">
            <xs:enumeration value="merge"/>
            <xs:enumeration value="ignore"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
