<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
  targetNamespace="http://autoquest.informatik.uni-goettingen.de/httpexchange"
  xmlns:tns="http://autoquest.informatik.uni-goettingen.de/httpexchange"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
  jxb:version="2.0"
  elementFormDefault="qualified">
  
  <xsd:element name="httpExchange" type="tns:HttpExchange" />

  <xsd:complexType name="HttpExchange">
    <xsd:sequence>
      <xsd:element name="sender" type="tns:Address" />
      <xsd:element name="receiver" type="tns:Address" />
      <xsd:element name="request" type="tns:HttpRequest" />
      <xsd:element name="response" type="tns:HttpResponse" />
    </xsd:sequence>
    <xsd:attribute name="status" use="required" type="tns:Status" />
  </xsd:complexType>

  <xsd:complexType name="HttpRequest">
    <xsd:sequence>
      <xsd:element name="headers" type="tns:Headers" minOccurs="0" maxOccurs="1" />
      <xsd:element name="cookies" type="tns:Cookies" minOccurs="0" maxOccurs="1" />
      <xsd:element name="authType" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="remoteUser" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="requestedSessionId" type="xsd:string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="content" type="tns:Content" minOccurs="0" maxOccurs="1" />
    </xsd:sequence>
    <xsd:attribute name="method" use="required" type="tns:Method" />
    <xsd:attribute name="protocol" use="required" type="tns:Protocol" />
    <xsd:attribute name="url" use="required" type="xsd:anyURI" />
    <xsd:attribute name="query" type="xsd:string" />
    <xsd:attribute name="orderingId" type="xsd:long" />
  </xsd:complexType>

  <xsd:complexType name="HttpResponse">
    <xsd:sequence>
      <xsd:element name="headers" type="tns:Headers" minOccurs="0" maxOccurs="1" />
      <xsd:element name="content" type="tns:Content" minOccurs="0" maxOccurs="1" />
    </xsd:sequence>
    <xsd:attribute name="status" use="required" type="xsd:integer" />
    <xsd:attribute name="orderingId" type="xsd:long" />
  </xsd:complexType>

  <xsd:complexType name="Address">
    <xsd:sequence>
      <xsd:element name="ip" type="xsd:string" />
      <xsd:element name="host" type="xsd:string" />
      <xsd:element name="port" type="xsd:integer" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Cookies">
    <xsd:sequence>
      <xsd:element name="cookie" type="tns:Cookie" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Cookie">
    <xsd:attribute name="comment" type="xsd:string" />
    <xsd:attribute name="domain" type="xsd:string" />
    <xsd:attribute name="maxAge" type="xsd:integer" />
    <xsd:attribute name="name" type="xsd:string" />
    <xsd:attribute name="path" type="xsd:string" />
    <xsd:attribute name="isHttpOnly" type="xsd:boolean" />
    <xsd:attribute name="isSecure" type="xsd:boolean" />
    <xsd:attribute name="value" type="xsd:string" />
    <xsd:attribute name="version" type="xsd:integer" />
  </xsd:complexType>

  <xsd:complexType name="Headers">
    <xsd:sequence>
      <xsd:element name="header" type="tns:Header" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Header">
    <xsd:attribute name="key" use="required" type="xsd:string" />
    <xsd:attribute name="value" use="required" type="xsd:string" />
  </xsd:complexType>

  <xsd:complexType name="Content">
    <xsd:sequence>
      <xsd:element name="data" type="xsd:string" />
    </xsd:sequence>
    <xsd:attribute name="encoding" use="required" type="xsd:string" />
    <xsd:attribute name="type" use="required" type="xsd:string" />
    <xsd:attribute name="length" use="required" type="xsd:long" />
  </xsd:complexType>

  <xsd:simpleType name="Method">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="OPTIONS"/>
      <xsd:enumeration value="GET"/>
      <xsd:enumeration value="HEAD"/>
      <xsd:enumeration value="POST"/>
      <xsd:enumeration value="PUT"/>
      <xsd:enumeration value="DELETE"/>
      <xsd:enumeration value="TRACE"/>
      <xsd:enumeration value="CONNECT"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="Protocol">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="HTTP/1.0"/>
      <xsd:enumeration value="HTTP/1.1"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="Status">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="success"/>
      <xsd:enumeration value="failure"/>
      <xsd:enumeration value="timeout"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>