Skip to main content
Published: March 29 2009, 5:40:00 PMUpdated: November 28 2020, 5:23:14 PM

How to manually change a WSDL document into an XSD file ?

Summary

  Here are simple steps to converting a WSDL document into an XSD schema file:

1. Download a WSDL, take the OpeneBayParticipantInterfaceService WSDL as below for example and save it locally say  to ./WSDL-XSD directory

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
     targetNamespace="http://www.ebay.com/marketplace/services"
     xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:ns0="http://www.ebay.com/marketplace/services"
     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
     xmlns="http://schemas.xmlsoap.org/wsdl/">

     <wsdl:types>
     
     
         
 <xs:schema attributeFormDefault="unqualified"
               
elementFormDefault="qualified"
               targetNamespace="http://www.ebay.com/marketplace/services"
               xmlns:tns="http://www.ebay.com/marketplace/services"
                xmlns:Q1="http://www.ebay.com/marketplace/services" xmlns:Q2="http://www.ebay.com/marketplace/services">



<xs:element name="addSubscriberRequest" nillable="true" type="tns:OpeneBayAddSubscriberRequestType"/>
<xs:element name="addSubscriberResponse" nillable="true" type="tns:OpeneBayAddSubscriberResponseType"/>
<xs:element name="removeSubscriberRequest" nillable="true" type="tns:OpeneBayRemoveSubscriberRequestType"/>
<xs:element name="removeSubscriberResponse" nillable="true" type="tns:OpeneBayRemoveSubscriberResponseType"/>


<!-- Common TYPES start -->
<xs:complexType name="OpeneBayPrincipalIdentifierType">
     <xs:attribute name="appId" type="xs:string">
          <xs:annotation>
     ...
     .....

               
               </CallInfo>
                              </xs:appinfo>
                         </xs:annotation>
                    </xs:element>
               </xs:sequence>
          </xs:extension>
     </xs:complexContent>
</xs:complexType>


<xs:complexType name="OpeneBayRemoveSubscriberResponseType">
     <xs:annotation>
          <xs:documentation>
               Response to a removeSubscriber call.
          </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
          <xs:extension base="tns:BaseServiceResponse">
          </xs:extension>
     </xs:complexContent>
</xs:complexType>


          </xs:schema>


     </wsdl:types>
     <wsdl:message name="addSubscriberRequest">
          <wsdl:part name="addSubsciberRequest" element="ns0:addSubscriberRequest">
         </wsdl:part>
     </wsdl:message>
     <wsdl:message name="addSubscriberResponse">
          <wsdl:part name="addSubscriberResponse" element="ns0:addSubscriberResponse">
         </wsdl:part>
     </wsdl:message>
     <wsdl:message name="removeSubscriberRequest">
          <wsdl:part name="removeSubsciberRequest" element="ns0:removeSubscriberRequest">
         </wsdl:part>
     </wsdl:message>
     <wsdl:message name="removeSubscriberResponse">
          <wsdl:part name="removeSubscriberResponse" element="ns0:removeSubscriberResponse">
         </wsdl:part>
     </wsdl:message>
     <wsdl:portType name="OpeneBayParticipantInterfaceServicePortType">
          <wsdl:operation name="addSubscriber">
               <wsdl:input message="ns0:addSubscriberRequest">
                    <!--  wsaw:Action="urn:addSubscriber"> -->
               </wsdl:input>
               <wsdl:output message="ns0:addSubscriberResponse">
                    <!-- wsaw:Action="urn:addSubscriberResponse">-->
               </wsdl:output>
          </wsdl:operation>
          <wsdl:operation name="removeSubscriber">
               <wsdl:input message="ns0:removeSubscriberRequest">
                    <!--  wsaw:Action="urn:addSubscriber"> -->
               </wsdl:input>
               <wsdl:output message="ns0:removeSubscriberResponse">
                    <!-- wsaw:Action="urn:addSubscriberResponse">-->
               </wsdl:output>
          </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="OpeneBayParticipantInterfaceServiceSoap12Binding" type="ns0:OpeneBayParticipantInterfaceServicePortType">
          <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="addSubscriber">
               <soap12:operation soapAction="urn:addSubscriber" style="document"/>
               <wsdl:input>
                    <soap12:body use="literal"/>
               </wsdl:input>
               <wsdl:output>
                    <soap12:body use="literal"/>
               </wsdl:output>
          </wsdl:operation>
          <wsdl:operation name="removeSubscriber">
               <soap12:operation soapAction="urn:removeSubscriber" style="document"/>
               <wsdl:input>
                    <soap12:body use="literal"/>
               </wsdl:input>
               <wsdl:output>
                    <soap12:body use="literal"/>
               </wsdl:output>
          </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="OpeneBayParticipantInterfaceServiceSoap11Binding" type="ns0:OpeneBayParticipantInterfaceServicePortType">
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="addSubscriber">
               <soap:operation soapAction="urn:addSubscriber" style="document"/>
               <wsdl:input>
                    <soap:body use="literal"/>
               </wsdl:input>
               <wsdl:output>
                    <soap:body use="literal"/>
               </wsdl:output>
          </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="OpeneBayParticipantInterfaceServiceHttpBinding" type="ns0:OpeneBayParticipantInterfaceServicePortType">
          <http:binding verb="POST"/>
          <wsdl:operation name="addSubscriber">
               <http:operation location="OpeneBayParticipantInterfaceService/addSubscriber"/>
               <wsdl:input>
                    <mime:content part="addSubscriberRequest" type="text/xml"/>
               </wsdl:input>
               <wsdl:output>
                    <mime:content part="addSubscriberResponse" type="text/xml"/>
               </wsdl:output>
          </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="OpeneBayParticipantInterfaceService">
          <wsdl:documentation>
               <Version>1.0.0</Version>
          </wsdl:documentation>
          <wsdl:port name="OpeneBayParticipantInterfaceServiceHttpSoap11Endpoint" binding="ns0:OpeneBayParticipantInterfaceServiceSoap11Binding">
               <soap:address location="http://10.254.49.67:9090/axis2/services/OpeneBayParticipantInterfaceService.OpeneBayParticipantInterfaceServiceHttpSoap11Endpoint"/>
          </wsdl:port>
          <wsdl:port name="OpeneBayParticipantInterfaceServiceHttpEndpoint" binding="ns0:OpeneBayParticipantInterfaceServiceHttpBinding">
               <http:address location="http://10.254.49.67:9090/axis2/services/OpeneBayParticipantInterfaceService.OpeneBayParticipantInterfaceServiceHttpEndpoint"/>
          </wsdl:port>
          <wsdl:port name="OpeneBayParticipantInterfaceServiceHttpSoap12Endpoint" binding="ns0:OpeneBayParticipantInterfaceServiceSoap12Binding">
               <soap12:address location="http://10.254.49.67:9090/axis2/services/OpeneBayParticipantInterfaceService.OpeneBayParticipantInterfaceServiceHttpSoap12Endpoint"/>
          </wsdl:port>
     </wsdl:service>
</wsdl:definitions>



2. Create OpeneBayParticipantInterface.xsd XML Schemal file:
    a. Take the contents of the xmlns:xs="http://www.w3.org/2001/XMLSchema" type section and it should start with <xs:schema ...> and end with </xs:schema> (both tags marked yellow above) .

    b. place it to a blank file named  WSDL-XSD/OpeneBayParticipantInterface.xsd , for example.

   c. check the generated XXX.xsd file and make sure each of the prefixes is associated with a namespace . If not, you will need to define it. For example, the xs prefix as xmlns:xs="http://www.w3.org/2001/XMLSchema" is declared in the OpeneBayParticipantInterface.wsdl document, and you must add it into the generated OpeneBayParticipantInterface.xsd document to avoid the error such as  prefix "xs" for element "xs:schema" is not bound 

Here is a snippet of the relevant section of the converted OpeneBayParticipantInterface.xsd XSD schema document.  

<xs:schema attributeFormDefault="unqualified"
               
elementFormDefault="qualified"
               targetNamespace="http://www.ebay.com/marketplace/services"
               xmlns:tns="http://www.ebay.com/marketplace/services"
               xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:Q1="http://www.ebay.com/marketplace/services" xmlns:Q2="http://www.ebay.com/marketplace/services">



<xs:element name="addSubscriberRequest" nillable="true" type="tns:OpeneBayAddSubscriberRequestType"/>
<xs:element name="addSubscriberResponse" nillable="true" type="tns:OpeneBayAddSubscriberResponseType"/>
<xs:element name="removeSubscriberRequest" nillable="true" type="tns:OpeneBayRemoveSubscriberRequestType"/>
<xs:element name="removeSubscriberResponse" nillable="true" type="tns:OpeneBayRemoveSubscriberResponseType"/>


<!-- Common TYPES start -->
<xs:complexType name="OpeneBayPrincipalIdentifierType">
     <xs:attribute name="appId" type="xs:string">
          <xs:annotation>
     ...
     .....

               
               </CallInfo>
                              </xs:appinfo>
                         </xs:annotation>
                    </xs:element>
               </xs:sequence>
          </xs:extension>
     </xs:complexContent>
</xs:complexType>


<xs:complexType name="OpeneBayRemoveSubscriberResponseType">
     <xs:annotation>
          <xs:documentation>
               Response to a removeSubscriber call.
          </xs:documentation>
     </xs:annotation>
     <xs:complexContent>
          <xs:extension base="tns:BaseServiceResponse">
          </xs:extension>
     </xs:complexContent>
</xs:complexType>


          </xs:schema>


  Attached please find the OpeneBayParticipantInterfaceService.xsd XML schema and the OpeneBayParticipantInterfaceService.wsdl document.

How well did this answer your question?
Answers others found helpful