Title: RE: Embedding XML Schema in WSDL

Hi,

You can embed your <xsd:schema> as a child of <type> element (a child of the WSDL root element). You should then be able to link (via <xsd:include>) or copy and paste your schema into your WSDL. I've attached an example I'm working on myself. ;-)

Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="Sales_Service" targetNamespace="http://www.sprokets.com/sales" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.sprokets.com/sales" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

        <!-- Data Types -->
        <types>
                <xsd:schema targetNamespace="http://www.sprokets.com/sales">
                        <xsd:complexType name="Product">
                                <xsd:sequence>
                                        <xsd:element name="Name" type="xsd:string"/>
                                        <xsd:element name="Code" type="xsd:string"/>
                                        <xsd:element name="Location" type="xsd:string"/>
                                </xsd:sequence>
                        </xsd:complexType>
                        <xsd:element name="PurchaseProduct">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="Product" type="tns:Product"/>
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                        <xsd:complexType name="Invoice">
                                <xsd:sequence>
                                        <xsd:element name="Number" type="xsd:decimal"/>
                                        <xsd:element name="Date" type="xsd:dateTime"/>
                                </xsd:sequence>
                        </xsd:complexType>
                        <xsd:element name="PurchaseProductResponse">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="Invoice" type="tns:Invoice"/>
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                </xsd:schema>
        </types>
        <!-- Messages -->
        <message name="PurchaseProduct">
                <part name="parameters" element="tns:PurchaseProduct"/>
        </message>
        <message name="PurchaseProductResponse">
                <part name="parameters" element="tns:PurchaseProductResponse"/>
        </message>
        <!-- Port Types -->
        <portType name="Sales_Service">
                <operation name="PurchaseProduct">
                        <input message="tns:PurchaseProduct"/>
                        <output message="tns:PurchaseProductResponse"/>
                </operation>
        </portType>
        <!-- Binding -->
        <binding name="Sales_ServiceBinding" type="tns:Sales_Service">
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="PurchaseProduct">
                        <soap:operation soapAction="urn:sales-service" style="document"/>
                        <input>
                                <soap:body namespace="http://www.sprokets.com/sales" use="literal"/>
                        </input>
                        <output>
                                <soap:body namespace="http://www.sprokets.com/sales" use="literal"/>
                        </output>
                </operation>
        </binding>
        <!-- Service -->
        <service name="Sales_Service">
                <port name="Sales_ServicePort" binding="tns:Sales_ServiceBinding">
                        <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/>
                </port>
        </service>
</definitions>

-----Original Message-----
From: John m [mailto:[EMAIL PROTECTED]]
Sent: 16 August 2001 21:41
To: [EMAIL PROTECTED]
Subject: Embedding XML Schema in WSDL


I have method which takes org.w3c.dom.Document as one
of the parameters. This Document is validated agains a
Order.xsd file. How do I generate a WSDL so that the
consumer knows that the input parameter should confirm
to Order.xsd file.

Or in other words how do I embed Order.xsd in WSDL
file.


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Reply via email to