Examples for ws service reference presentation - WSD WG f2f Sep 2003

Below: Example_1 | Example_2 | Example_3

Example 1


Fully static type information. Neither the interface nor binding of the Manager and Engineer services are sent in the
message. Both the interface and binding service type information is described in the Department WSDL using derived types of xs:anyUri.

<soap:Envelope>
    <soap:Body>
    <hr:Department deptNo="123" xmlns:hr="http://hr.example.com">
        <hr:Manager>http://hr.example.com/employee/smith/judy</hr:Manager>
        <hr:Engineer>http://hr.example.com/employee/jones/tom</hr:Engineer>
        <hr:Engineer>http://hr.example.com/employee/lee/jin</hr:Engineer>
    </hr:Department>
    </soap:Body>
</soap:Envelope>

<wsdl:definitions targetnamespace="http://hr.example.com"
    xmlns:hr="http://hr.example.com">

    <wsdl:types>
        <xs:schema targetnamespace="http://hr.example.com">

            <xs:simpleType name="ManagerReference">
                <xs:restriction base="xs:anyUri"/>
            </xs:simpleType>

            <xs:simpleType name="EngineerReference">
                <xs:restriction base="xs:anyUri"/>
            </xs:simpleType>

            <xs:element name="DepartmentNumber" type="xs:string"/>

            <xs:element name="Department">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Manager" type="hr:ManagerReference"/>
                        <xs:element name="Engineer" type="hr:EngineerReference"
                            minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="deptno" type="xs:string"/>
                </xs:complexType>
            </xs:element>

        </xs:schema>
    </wsdl:types>

    <wsdl:interface name="Manager">...</wsdl:interface>

    <wsdl:interface name="Engineer">...</wsdl:interface>

    <wsdl:interface name="Department">
        <wsdl:operation name="getDepartment">
            <wsdl:input body="hr:DepartmentNumber"/>
            <wsdl:output body="hr:Department">
                <wsdl:reference type="hr:ManagerReference" interface="hr:Manager"/>
                <wsdl:reference type="hr:EngineerReference" interface="hr:Engineer"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:interface>

    <wsdl:binding name="ManagerSOAP" interface="hr:Manager"/>

    <wsdl:binding name="EngineerSOAP" interface="hr:Engineer"/>

    <wsdl:binding name="DepartmentSOAP" interface="hr:Department">
        <soap:binding ... />
        <wsdl:operation name="getDepartment">
            <wsdl:input>...</wsdl:input>
            <wsdl:output>
                <wsdl:reference type="hr:ManagerReference" binding="hr:ManagerSOAP"/>
                <wsdl:reference type="hr:EngineerReference" binding="hr:EngineerSOAP"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="DepartmentService" interface="hr:Department">
        <wsdl:endpoint name="DepartmentServiceSOAP" binding="hr:DepartmentSOAP">
            <soap:address location="http://hr.example.com/department"/>
        </wsdl:endpoint>
    </wsdl:service>   

</wsdl:definitions>

Example 2

Partially dynamic type information. Both the interface and binding of the Manager and Engineer services are sent in the message using derived types of wsdl:Service. Only the interface service type information is described in the Department WSDL.

<soap:Envelope>
    <soap:Body>
    <hr:Department deptNo="123" xmlns:hr="http://hr.example.com"
        wsdl:descriptionLocation="http://hr.example.com http://hr.example.com/department.wsdl">
        <hr:Manager interface="hr:Manager">
            <wsdl:endpoint binding="hr:ManagerSOAP">
                <soap:address location="http://hr.example.com/employee/smith/judy">
            </wsdl:endpoint>
        </hr:Manager>
        <hr:Engineer interface="hr:Engineer">
            <wsdl:enpoint binding="hr:EngineerSOAP">
                <soap:address location="http://hr.example.com/employee/jones/tom"/>
            </wsdl:endpoint>
        </hr:Engineer>
        <hr:Engineer interface="hr:Engineer">
            <wsdl:enpoint binding="hr:EngineerSOAP">
                <soap:address location="http://hr.example.com/employee/lee/jin"/>
            </wsdl:endpoint>
        </hr:Engineer>
    </hr:Department>
    </soap:Body>
</soap:Envelope>

<wsdl:definitions targetnamespace="http://hr.example.com"
    xmlns:hr="http://hr.example.com">

    <wsdl:types>
        <xs:schema targetnamespace="http://hr.example.com">

            <xs:complexType name="ManagerReference">
                <xs:complexContent>
                    <xs:extension base="wsdl:Service"/>
                <xs:complexContent>
            </xs:complexType>

            <xs:complexType name="EngineerReference">
                <xs:complexContent>
                    <xs:extension base="wsdl:Service"/>
                <xs:complexContent>
            </xs:complexType>

            <xs:element name="DepartmentNumber" type="xs:string"/>

            <xs:element name="Department">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Manager" type="hr:ManagerReference"/>
                        <xs:element name="Engineer" type="hr:EngineerReference"
                            minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="deptno" type="xs:string"/>
                </xs:complexType>
            </xs:element>

        </xs:schema>
    </wsdl:types>

    <wsdl:interface name="Manager">...</wsdl:interface>

    <wsdl:interface name="Engineer">...</wsdl:interface>

    <wsdl:interface name="Department">
        <wsdl:operation name="getDepartment">
            <wsdl:input body="hr:DepartmentNumber"/>
            <wsdl:output body="hr:Department">
                <wsdl:reference type="hr:ManagerReference" interface="hr:Manager"/>
                <wsdl:reference type="hr:EngineerReference" interface="hr:Engineer"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:interface>

    <wsdl:binding name="ManagerSOAP" interface="hr:Manager"/>

    <wsdl:binding name="EngineerSOAP" interface="hr:Engineer"/>

    <wsdl:binding name="DepartmentSOAP" interface="hr:Department">
        <soap:binding ... />
        <wsdl:operation name="getDepartment">
            <wsdl:input>...</wsdl:input>
            <wsdl:output>...</wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="DepartmentService" interface="hr:Department">
        <wsdl:endpoint name="DepartmentServiceSOAP" binding="hr:DepartmentSOAP">
            <soap:address location="http://hr.example.com/department"/>
        </wsdl:endpoint>
    </wsdl:service>   

</wsdl:definitions>

Example 3

Fully dynamic type information. Both the interface and binding of the Manager and Engineer services are sent in the
message using wsdl:Service. No service type information is described in the Department WSDL.

<soap:Envelope>
    <soap:Body>
    <hr:Department deptNo="123" xmlns:hr="http://hr.example.com"
        wsdl:descriptionLocation="http://hr.example.com http://hr.example.com/department.wsdl">
        <hr:Manager interface="hr:Manager">
            <wsdl:endpoint binding="hr:ManagerSOAP">
                <soap:address location="http://hr.example.com/employee/smith/judy">
            </wsdl:endpoint>
        </hr:Manager>
        <hr:Engineer interface="hr:Engineer">
            <wsdl:enpoint binding="hr:EngineerSOAP">
                <soap:address location="http://hr.example.com/employee/jones/tom"/>
            </wsdl:endpoint>
        </hr:Engineer>
        <hr:Engineer interface="hr:Engineer">
            <wsdl:enpoint binding="hr:EngineerSOAP">
                <soap:address location="http://hr.example.com/employee/lee/jin"/>
            </wsdl:endpoint>
        </hr:Engineer>
    </hr:Department>
    </soap:Body>
</soap:Envelope>

<wsdl:definitions targetnamespace="http://hr.example.com"
    xmlns:hr="http://hr.example.com">

    <wsdl:types>
        <xs:schema targetnamespace="http://hr.example.com">

            <xs:element name="DepartmentNumber" type="xs:string"/>

            <xs:element name="Department">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Manager" type="wsdl:Service"/>
                        <xs:element name="Engineer" type="wsdl:Service"
                            minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="deptno" type="xs:string"/>
                    <xs:attribute ref="wsdl:descriptionLocation"/>
                </xs:complexType>
            </xs:element>

        </xs:schema>
    </wsdl:types>

    <wsdl:interface name="Manager">...</wsdl:interface>

    <wsdl:interface name="Engineer">...</wsdl:interface>

    <wsdl:interface name="Department">
        <wsdl:operation name="getDepartment">
            <wsdl:input body="hr:DepartmentNumber"/>
            <wsdl:output body="hr:Department">
            </wsdl:output>
        </wsdl:operation>
    </wsdl:interface>

    <wsdl:binding name="ManagerSOAP" interface="hr:Manager"/>

    <wsdl:binding name="EngineerSOAP" interface="hr:Engineer"/>

    <wsdl:binding name="DepartmentSOAP" interface="hr:Department">
        <soap:binding ... />
        <wsdl:operation name="getDepartment">
            <wsdl:input>...</wsdl:input>
            <wsdl:output>...</wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="DepartmentService" interface="hr:Department">
        <wsdl:endpoint name="DepartmentServiceSOAP" binding="hr:DepartmentSOAP">
            <soap:address location="http://hr.example.com/department"/>
        </wsdl:endpoint>
    </wsdl:service>   

</wsdl:definitions>