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

    Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<wsdl:definitions name="Mtom Sample"
                  xmlns:types="http://example.org/mtom/data"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:tns="http://example.org/mtomsample"
                  targetNamespace="http://example.org/mtomsample">

    <wsdl:types>
        <schema
                xmlns="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://example.org/mtom/data"
                xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
                elementFormDefault="qualified">

            <!-- annotating the 'data' element below with xmime:expectedContentTypes will
                 result in to this paramter mapped to java.awt.Image
             -->
            <element name="photo" type="base64Binary" xmime:expectedContentTypes="image/jpeg"/>
            <element name="data" type="base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
            <element name="uploadResponse" type="string"/>
            <element name="size" type="int"/>
        </schema>

    </wsdl:types>

    <wsdl:message name="uploadRequest">
        <wsdl:part name="data" element="types:photo"/>
    </wsdl:message>

    <wsdl:message name="uploadResponse">
        <wsdl:part name="response" element="types:uploadResponse"/>
    </wsdl:message>


    <wsdl:message name="downloadRequest">
        <wsdl:part name="size" element="types:size"/>
    </wsdl:message>

    <wsdl:message name="downloadResponse">
        <wsdl:part name="data" element="types:data"/>
    </wsdl:message>

    <wsdl:portType name="MtomSample">
        <wsdl:documentation>MTOM Sample.</wsdl:documentation>
        <wsdl:operation name="upload">
            <wsdl:documentation>Photo upload operation</wsdl:documentation>
            <wsdl:input message="tns:uploadRequest"/>
            <wsdl:output message="tns:uploadResponse"/>
        </wsdl:operation>

        <wsdl:operation name="download">
            <wsdl:documentation>Streaming data download operation</wsdl:documentation>
            <wsdl:input message="tns:downloadRequest"/>
            <wsdl:output message="tns:downloadResponse"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="MtomBinding" type="tns:MtomSample">
        <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="upload">
            <soap12:operation soapAction=""/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>

        <wsdl:operation name="download">
            <soap12:operation soapAction=""/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>

    </wsdl:binding>

    <wsdl:service name="MtomService">
        <wsdl:port name="MtomPort" binding="tns:MtomBinding">
            <soap12:address location="http://example/mtomsample"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>	
