How to avoid / solve Spring validation errors ?

I integrated spring IDE plug-ins in my eclipse environment. I wanted use some additional namespaces like camel, CXF and some custom schema to spring.xml, spring beans file. When I tried to validate the spring.xml file the spring IDE it was showing following errors and warnings in "Problems" / "Error Log" view of eclipse

  •  Unable to locate Spring Namespace handler...
  •  Incorrect usage of element for certain elements ... (The element was refereed form my custom schema)
  •  Many errors of Class Not Found.
  •  No setter found for property ... (When I am trying to set some property in spring.xml) 

Here, I am going to discuss the approaches I used to solve these issues, read complete article at http://technical-tejash.blogspot.com/2010/03/how-to-avoid-spring-validation-errors.html

Eclipse Tools: Howt to avoid cyclic dependency between 2 plugins without refactoring code

I have encountered a cyclic dependency issue while developing application using eclipse based plug-in development environment. Here I am going to explain the issue, which you might be also encountered during the plug-in development and which would have lead you to re-factorize your code to solve this issue. But here I am going to use extension-point using which I can invoke execute code from another plug-in and get results without adding interdependency between them.

Example:
I have eclipse plug-ins PluginA and PluginB, here PluginB is already dependent on PluginA. Now I have some class method in PluginB, and I would like to execute that method from one of the class in PluginA .
- If we add the dependency of PluginA on PluginB then it would result in cyclic dependency.
- Alternatively, what we can do is to re-factor the code in such a way that this method and relevant calsses moved to PluginA so that it would be available in both PluginA and PluginB, but this solution will be expensive in the well deployed system since it involves lot of testing efforts and it may break, if we missed out something during re-factoring, And there may more such logic should come out and again we need to re-factorize with same process.
- Here, I am going to discuss alternate and permanent solution which can be used for calling method of the class which belong to PluginB form some class of PluginA without adding dependency and avoiding the re-factorization of the code.

Visit http://technical-tejash.blogspot.com/2010/03/eclipse-avoid-cyclic-dependency-between.html for step by step guide about Using extension-point to avoid cyclic dependency between 2 plugins without refactoring code

Eclipse WTP Web Service Wizard tweaks

The following post talks about how to implement a custom Web Service Solution using Eclipse WTP Web Service wizard:

I have shared few basics, tweaks and customizations that can be done to the Web Service Wizard at Eclipse WTP Web Service Wizard tweaks.

WS-I Basic Profile 1.1 and Schema Reference Behaviors and Specifications

What is the need for WS-I Basic Profile?

WS-I Basic Profile defines specification for WSDL document to avoid the confusion present in WSDL specification. As per WSDL specification following example is valid but as per WS-I it is incorrect

<wsdl:definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/definitions"
xmlns:stock="http://example.com/stockquote/schemas""
...
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

< wsdl:import namespace="http://example.com/stockquote/schemas"
location="http://example.com/stockquote/stockquote.xsd"/>

< wsdl:message name="GetLastTradePriceInput">
< wsdl:part name="body" element="xsd1:TradePriceRequest"/>
</ wsdl:message>
...
</ wsdl:definitions>


As per WS-I Basic Profile we can import only WSDL document using wsdl:import. For importing XSD document we need to use xsd:import within wsdl:type section as follows:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/definitions"
xmlns:stock="http://example.com/stockquote/schemas"
...
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="urn:myschema"
xmlns:stock="http://example.com/stockquote/schemas"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://example.com/stockquote/schemas" schemaLocation="http://example.com/stockquote/stockquote.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetLastTradePriceInput">
< wsdl:part name="body" element="stock:TradePriceRequest"/>
</wsdl:message>
...
</wsdl:definitions>



What am I going to discuss in this post?

On reading the spec it is not immediately clear what the point means and having examples would be really useful. So I am going to discuss the points from the spec related to types/elements visibility with several examples. WS-I Basic Profile provides specifications for WSDL, SOAP, XML, XML Schema and many other things related to Web Services. Among these, I am going to discuss about the visibility of types defined in the Type section of WSDL as well as imported / included types from XML schema (XSD). Also how XML schema data types are visible within schema document as well as across imported and included schema documents.

I will begin with visibility for XSD document and later discuss the type visibility for WSDL document

Visibility for XSD document along with sample XML document
  1. Import XSD document inside another XSD document

    • Types, elements, attributes and groups defined in imported XSD document should be visible inside current XSD document

      • Example:

        SubSchema.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://subNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://subNamespace.com"
        xmlns="http://subNamespace.com">
        <xsd:complexType name="AComplexTypeInSubSchema">
        <xsd:sequence>
        <xsd:element name="SomeData" type="xsd:string">
        </xsd:element>
        <xsd:element name="SomeMoreData" type="xsd:string">
        </xsd:element>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        MasterSchema.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://masterNamespace.com"
        xmlns:ssns="http://subNamespace.com"
        xmlns:tns="http://masterNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://subNamespace.com" schemaLocation="SubSchema.xsd"/>
        <xsd:complexType name="AComplexTypeInMaster">
        <xsd:sequence>
        <xsd:element name="MasterTypeData1" type="xsd:string"/>
        <xsd:element name="ElementFromSubSchemaType" type="ssns:AComplexTypeInSubSchema"/>
        </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="ElementFromMasterSchemaType" type="tns:AComplexTypeInMaster"/>
        </xsd:schema>


      • As shown in above examples "AComplexTypeInSubSchema" is defined in "SubSchema.xsd" which becomes visible in MasterSchema.xsd after "SubSchema.xsd" is imported inside "MasterSchema.xsd".

      • Note: "AComplexTypeInSubSchema" is accessible in MasterSchema.xsd using namespace prefix ssns defined for its namespace "http://subNamespace.com"
      • Sample XML Document using ElementFromMasterSchemaType
        <?xml version="1.0" encoding="UTF-8"?>
        <com:ElementFromMasterSchemaType xsi:schemaLocation="http://masterNamespace.com file:/C:/Schemas/importedtypes/MasterSchema.xsd"
        xmlns:com="http://masterNamespace.com"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <MasterTypeData1>string</MasterTypeData1>
        <ElementFromSubSchemaType>
        <SomeData>string</SomeData>
        <SomeMoreData>string</SomeMoreData>
        </ElementFromSubSchemaType>
        </com:ElementFromMasterSchemaType>


    • Types, elements, attributes and groups defined in nested imported XSD document not be visible inside current XSD document

      • Example:

        SubSchema2.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://subNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://subNamespace2.com"
        xmlns="http://subNamespace.com">
        <xsd:complexType name="ANestedComplexTypeInSubSchema">
        <xsd:sequence>
        <xsd:element name="SomeData" type="xsd:string">
        </xsd:element>
        <xsd:element name="SomeMoreData" type="xsd:string">
        </xsd:element>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        SubSchema.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://subNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://subNamespace.com"
        xmlns:ssns="http://subNamespace2.com"
        xmlns="http://subNamespace.com">
        <xsd:import namespace="http://subNamespace2.com" schemaLocation="SubSchema2.xsd"/>
        <xsd:complexType name="AComplexTypeInSubSchema">
        <xsd:sequence>
        <xsd:element name="SomeData" type="xsd:string">
        </xsd:element>
        <xsd:element name="SomeMoreData" type="xsd:string">
        </xsd:element>
        <xsd:element name="ElementFromNestedSubSchemaType" type="ssns:ANestedComplexTypeInSubSchema"/><!-- This is valid -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        MasterSchema.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://masterNamespace.com"
        xmlns:ssns="http://subNamespace.com"
        xmlns:tns="http://masterNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://subNamespace.com" schemaLocation="SubSchema.xsd"/>
        <xsd:complexType name="AComplexTypeInMaster">
        <xsd:sequence>
        <xsd:element name="MasterTypeData1" type="xsd:string"/>
        <xsd:element name="MasterTypeData2" type="xsd:string"/>
        <xsd:element name="ElementFromNestedSubSchemaType" type="ssns:ANestedComplexTypeInSubSchema"/><!-- This is not valid -->
        <xsd:element name="ElementFromSubSchemaType" type="ssns:AComplexTypeInSubSchema"/><!-- This is valid -->
        </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="ElementFromMasterSchemaType" type="tns:AComplexTypeInMaster"/>
        </xsd:schema>


      • In the above examples MasterSchema.xsd is importing SubSchema.xsd and SubSchema.xsd is further importing SubSchema2.xsd. As I mentioned above nested imported types are not visible in the current schema document. Therefor, using ANestedComplexTypeInSubSchema which is defined in SubSchema2.xsd is invalid for MasterSchema.xsd but same thing is valid inside SubSchema.xsd since it is directly importing SubSchema2.xsd

      • As per the previous example using AComplexTypeInSubSchema inside MasterSchema.xsd is valid, since we have imported SubSchema.xsd in MasterSchema.xsd



    • If imported XSD file has included some XSD files then type, elements, attributes and groups defined in that nested included XSD file should be visible inside current XSD document

      • Example:

        SubSchema2.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://subNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://subNamespace2.com"
        xmlns="http://subNamespace.com">
        <xsd:complexType name="ANestedComplexTypeInSubSchema">
        <xsd:sequence>
        <xsd:element name="SomeData" type="xsd:string">
        </xsd:element>
        <xsd:element name="SomeMoreData" type="xsd:string">
        </xsd:element>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        SubSchema.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://subNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://subNamespace.com"
        xmlns="http://subNamespace.com">
        <xsd:include schemaLocation="SubSchema2.xsd"/>
        <xsd:complexType name="AComplexTypeInSubSchema"> <!-- This is valid -->
        <xsd:sequence>
        <xsd:element name="mysubelement" type="xsd:string">
        </xsd:element>
        <xsd:element name="nestedIncludedElement" type="ANestedComplexTypeInSubSchema">
        </xsd:element>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        MasterSchema.xsd
        <?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://masterNamespace.com"
        xmlns:ssns="http://subNamespace.com"
        xmlns:tns="http://masterNamespace.com"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://subNamespace.com" schemaLocation="SubSchema.xsd"/>
        <xsd:complexType name="AComplexTypeInMaster">
        <xsd:sequence>
        <xsd:element name="MasterTypeData1" type="xsd:string"/>
        <xsd:element name="ElementFromSubSchemaType" type="ssns:AComplexTypeInSubSchema"/> <!-- This is valid -->
        <xsd:element name="myNestedIncluedElement" type="ssns:ANestedComplexTypeInSubSchema"/><!-- This is valid -->
        </xsd:sequence>
        </xsd:complexType>

        <xsd:element name="ElementFromMasterSchemaType" type="tns:AComplexTypeInMaster"/>
        </xsd:schema>

      • In the above examples MasterSchema.xsd is importing SubSchema.xsd and SubSchema.xsd is further including SubSchema2.xsd. As I mentioned above nested included types are not visible in the current schema document. Therefor, using ANestedComplexTypeInSubSchema which is defined in SubSchema2.xsd is valid for MasterSchema.xsd and also inside SubSchema.xsd since it is directly importing SubSchema2.xsd

      • Sample XML Document using ElementFromMasterSchemaType in MasterSchema.xsd

      • <?xml version="1.0" encoding="UTF-8"?>
        <com:ElementFromMasterSchemaType
        xsi:schemaLocation="http://masterNamespace.com file:/C:/Schemas/nestedImport/MasterSchema.xsd"
        xmlns:com="http://masterNamespace.com"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <MasterTypeData1>string</MasterTypeData1>
        <ElementFromSubSchemaType>
        <mysubelement>string</mysubelement>
        <nestedIncludedElement>
        <SomeData>string</SomeData>
        <SomeMoreData>string</SomeMoreData>
        </nestedIncludedElement>
        </ElementFromSubSchemaType>
        <myNestedIncluedElement>
        <SomeData>string</SomeData>
        <SomeMoreData>string</SomeMoreData>
        </myNestedIncluedElement>
        </com:ElementFromMasterSchemaType>



  2. Include XSD document within another XSD


    • Types, elements, attributes and groups defined in included XSD file should be visible inside current XSD document

      • Examples

        A.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        B.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace">
        <xsd:include schemaLocation="A.xsd"/>
        <xsd:element name="BAElement" type="BType"/>
        <xsd:element name="AElementInsideB" type="AType"/> <!-- Valid Included Type -->
        <xsd:complexType name="BType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


      • As shown in the above example B.xsd is including A.xsd and hence AType is visible inside B.xsd



    • Types, elements, attributes and groups defined in nested included XSD file should be visible inside current XSD document

      • Example

        A.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        B.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace">
        <xsd:include schemaLocation="A.xsd"/>
        <xsd:element name="BAElement" type="BType"/>
        <xsd:element name="AElementInsideB" type="AType"/> <!-- This is valid Included Type -->
        <xsd:complexType name="BType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        C.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace">
        <xsd:include schemaLocation="B.xsd"/>
        <xsd:element name="CElement" type="CType"/>
        <xsd:element name="AElementInsideC" type="AType"/> <!-- This is valid Nested included Type -->
        <xsd:element name="BElementInsideC" type="BType"/> <!-- This is valid direct included Type -->
        <xsd:complexType name="CType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>

      • In the above examples B.xsd is including A.xsd and C.xsd is including B.xsd, i.e. A.xsd is nested included inside C.xsd. As I mentioned above the AType defined in A.xsd is visible inside B.xsd as well as C.xsd


    • If included XSD files has imported some XSD file then those types, elements, attributes and groups defined in that nested imported XSD file must not be visible inside current XSD document.
      If we want to make types, elements, attributes and groups from nested imported XSD document visible then need to explicitly import that XSD document.

      • Exammple

        D.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/anothernamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/anothernamespace">
        <xsd:element name="DElement" type="DType"/>
        <xsd:complexType name="DType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        B.xsd
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace"
        xmlns:dn="http://example.org/anothernamespace">
        <xsd:import namespace="http://example.org/anothernamespace" schemaLocation="D.xsd"/>
        <xsd:element name="BAElement" type="BType"/>
        <xsd:element name="DElementInsideB" type="dn:DType"/> <!-- Valid use of Imported Type -->
        <xsd:complexType name="BType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        C.xsd (Invalid use of nested import)
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace">
        <xsd:include schemaLocation="B.xsd"/>
        <xsd:element name="CElement" type="CType"/>
        <xsd:element name="AElementInsideC" type="BType"/><!-- This is valid, included Type -->
        <xsd:element name="DElementInsideC" type="dn:DType"/&gt;<!-- This is not valid, nested imported Type -->
        <xsd:complexType name="CType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        C.xsd (Valid use of imported type)
        <?xml version="1.0"?>
        <xsd:schema targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://example.org/mynamespace"
        xmlns:dn="http://example.org/anothernamespace">
        <xsd:include schemaLocation="B.xsd"/>
        <xsd:import namespace="http://example.org/anothernamespace" schemaLocation="D.xsd"/>
        <xsd:element name="CElement" type="CType"/>
        <xsd:element name="AElementInsideC" type="BType"/><!-- This is valid, included Type -->
        <xsd:element name="DElementInsideC" type="dn:DType"/><!-- This is valid, imported Type -->
        <xsd:complexType name="CType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>

      • As shown in the above example B.xsd is importing D.xsd so it is valid to use DType in B.xsd

      • In invalid C.xsd we are including B.xsd in C.xsd. In this case using BType inside C.xsd is valid case but using DType inside C.xsd is invalid since it is not imported in C.xsd and hence it is not visible as I mentioned before

      • To make DType visible inside C.xsd we must import D.xsd in C.xsd as shown in the valid example above


Visibility for WSDL document along with sample WSDL document
  1. Importing WSDL/XSD document using <wsdl:import>

    • Types, elements, attributes and groups defined in imported WSDL/XSD document must not be visible inside current WSDL document, but the other parts of the imported WSDL are visible inside current WSDL(read next point for more details)

      • Examples

        listing5.wsdl
        <?xml version="1.0"?>
        <wsdl:definitions targetNamespace="urn:listing5"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <wsdl:types>
        <xsd:schema targetNamespace="urn:listing5"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://www.w3.org/2001/XMLSchema"/>
        <xsd:complexType name="Phone">
        <xsd:sequence>
        <xsd:element name="areaCode" type="xsd:int"/>
        <xsd:element name="exchange" type="xsd:int"/>
        <xsd:element name="number" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        </wsdl:definitions>


        listing.wsdl
        <?xml version="1.0"?>
        <wsdl:definitions targetNamespace="urn:listing4"
        xmlns:tns="urn:listing4"
        xmlns:listing5="urn:listing5"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
        <wsdl:import namespace="urn:listing5" location="listing5.wsdl"/>
        <wsdl:types>
        <xsd:schema targetNamespace="urn:listing4"
        xmlns:listing5="urn:listing5"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://www.w3.org/2001/XMLSchema"/>
        <xsd:complexType name="Address">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="phone" type="listing5:Phone"/><!-- This is imported type form listing5.wsdl which not valid according to Basic Profile -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="GetAddressRequest">
        <wsdl:part name="name" type="xsd:string"/>
        </wsdl:message>
        <wsdl:message name="GetAddressResponse">
        <wsdl:part name="address" type="listing5:Phone"/><!-- This is imported type form listing5.wsdl which not valid according to Basic Profile -->
        </wsdl:message>
        <wsdl:message name="GetPhoneRequest">
        <wsdl:part name="name" type="xsd:string"/>
        </wsdl:message>
        <wsdl:message name="GetPhoneResponse">
        <wsdl:part name="phone" type="listing5:Phone"/><!-- This is imported type form listing5.wsdl which not valid according to Basic Profile -->
        </wsdl:message>
        <wsdl:portType name="AddressBook">
        <wsdl:operation name="getAddress">
        <wsdl:input message="tns:GetAddressRequest"/>
        <wsdl:output message="tns:GetAddressResponse"/>
        </wsdl:operation>
        <wsdl:operation name="getPhone">
        <wsdl:input message="tns:GetPhoneRequest"/>
        <wsdl:output message="tns:GetPhoneResponse"/>
        </wsdl:operation>
        </wsdl:portType>
        </wsdl:definitions>


      • In the above example listing.wsdl is importing listing5.wsdl using wsdl:import and we are using xsd type Phone defined in listing5.wsdl inside listing.wsdl which looks correct when you see this first time. But as per basic profile this is not allowed and listing.wsdl is invalid WSDL document as per basic profile WS-I

      • If we want to import some type in WSDL document then we must declare it inside XSD document and import this using xsd:import I will discuss xsd:import in more details in following points

    • <wsdl:import> must be used only for importing another WSDL description other than wsdl:type section and <wsdl:import> must not be used to import an XSD schema document. We must use <xsd:import> to import XSD schema documents

      • Examples

        Imported.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions name="Imported"
        targetNamespace="http://www.example.org/Imported/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="http://www.example.org/Imported/"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <wsdl:types>
        <xsd:schema targetNamespace="http://www.example.org/Imported/">
        <xsd:element name="NewOperationResponse" type="xsd:string"/>
        <xsd:element name="NewOperationRequest" type="xsd:string"/>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="NewOperationResponse">
        <wsdl:part element="tns:NewOperationResponse" name="NewOperationResponse"/>
        </wsdl:message>
        <wsdl:message name="NewOperationRequest">
        <wsdl:part element="tns:NewOperationRequest" name="NewOperationRequest"/>
        </wsdl:message>
        <wsdl:portType name="Imported">
        <wsdl:operation name="NewOperation">
        <wsdl:input message="tns:NewOperationRequest"/>
        <wsdl:output message="tns:NewOperationResponse"/>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="ImportedSOAP" type="tns:Imported">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="NewOperation">
        <soap:operation soapAction="http://www.example.org/Imported/NewOperation"/>
        <wsdl:input>
        <soap:body parts="NewOperationRequest" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body parts="NewOperationResponse" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="Imported">
        <wsdl:port binding="tns:ImportedSOAP" name="ImportedSOAP">
        <soap:address location="http://www.example.org/"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>


        Master.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions targetNamespace="urn:ESBP_TO_WSDL/xsd/examples/Master"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/examples/Master"
        xmlns:imp="http://www.example.org/Imported/">
        <wsdl:import namespace="http://www.example.org/Imported/" location="Imported.wsdl"/>
        <wsdl:types>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="xsd:anyType">
        </wsdl:part>
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput" type="xsd:anyType">
        </wsdl:part>
        </wsdl:message>
        <wsdl:portType name="MasterPortType">
        <wsdl:operation name="Master">
        <wsdl:input message="tns:Request">
        </wsdl:input>
        <wsdl:output message="tns:Response">
        </wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="MasterSOAPBinding" type="tns:MasterPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Master">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/examples/Master:MasterPortType:MasterRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/examples/Master" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/examples/Master" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="MasterService">
        <wsdl:port name="MasterPort" binding="tns:MasterSOAPBinding">
        <soap:address location="http://localhost:2580/process/Master"/>
        </wsdl:port>
        </wsdl:service>
        <wsdl:service name="ImportedService">
        <wsdl:port name="ImportedPort" binding="imp:ImportedSOAP"><!-- Referring to imported binding which is correct as per WS-I Basic Profile -->
        <soap:address location="http://localhost:2580/process/Imported"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>


      • In the above examples we are importing Imported.wsdl into Master.wsdl and we are referring to binding ImportedSOAP defined inside Imported.wsdl into Master.wsdl which is correct use of wsdl:import as per WS-I Basic Profile Specifications


    • Importing XSD using <wsdl:import> is not valid, we must use <xsd:import> for importing XSD file inside WSDL file

      • Example

        Sample.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:ESBP_TO_WSDL/xsd/examples/Master" xmlns:imp="http://www.example.org/Imported/" targetNamespace="urn:ESBP_TO_WSDL/xsd/examples/Master" >
        <wsdl:import namespace="http://www.example.org/Imported/" location="Imported.wsdl"/> <!-- This is valid, importing wsdl document using wsdl:import -->
        <wsdl:import namespace="http://www.example.org/Imported/" location="Imported.xsd"/> <!-- This is invalid, we must use xsd:import to import xsd file as per basic profile -->

        <wsdl:types>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="xsd:anyType"></wsdl:part>
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput" type="xsd:anyType"></wsdl:part>
        </wsdl:message>
        <wsdl:portType name="MasterPortType">
        <wsdl:operation name="Master">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="MasterSOAPBinding" type='tns:MasterPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Master">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/examples/Master:MasterPortType:MasterRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/examples/Master" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/examples/Master" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="MasterService">
        <wsdl:port name="MasterPort" binding='tns:MasterSOAPBinding' >
        <soap:address location="http://localhost:2580/process/Master"/>
        </wsdl:port>
        </wsdl:service>
        <wsdl:service name="ImportedService">
        <wsdl:port name="ImportedPort" binding='imp:ImportedSOAP' >
        <soap:address location="http://localhost:2580/process/Imported"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>

      • In the above Sample.wsdl document we have imported XSD schema documnet Imported.xsd using wsdl:import which is not allowed as per WS-I basic profile and we must use xsd:import to import XSD schema documents which I am going to discuss in the following points

  2. Importing XSD file using <xsd:import> within <xsd:schema> section of <wsdl:types> section of WSDL document

    • Types, elements, attributes and groups defined in imported XSD schema document (using <xsd:import>) should be visible inside same <xsd:schema> section of <wsdl:types> section

      • Examples

        A.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        A.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:A="http://example.org/mynamespace"> <!-- Namespaces are declared here for imported XSD as well as for schema section namespace -->
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">
        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="A.xsd"></xsd:import> <!-- Correct method of importing XSD schema socument in WSDL as per WS-I Basic Profile Specifications -->
        <xsd:element name="ElementOfTypeA" type="A:AType"></xsd:element> <!-- Imported Type from A.xsd -->
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="ElFromA" ref="A:AElement"/> <!-- Imported element from A.xsd -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="A:AType"></wsdl:part><!-- Imported Type from A.xsd -->
        <wsdl:part name="DefaultInput2" element="A:AElement"></wsdl:part> <!-- Imported element from A.xsd -->
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput"
        type="test:MyComplexType"></wsdl:part> <!-- Type from schema section -->
        <wsdl:part name="DefaultOutput2"
        element="test:ElementOfTypeA"></wsdl:part><!-- Element from schema section -->
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>

      • In the above examples A.wsdl is importing A.xsd using xsd:import withing xsd:schema section of wsdl:types section of WSDL document which is correct way of importing XSD schema document inside WSDL document as per WS-I Basic Profile Specifications

    • Types, elements, attributes and groups defined in imported XSD file should not be visible inside another <xsd:schema> section of <wsdl:types> unless it is explicitly imported in that <xsd:schema> schema section using <xsd:import>
      • Examples

        A.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        A.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:A="http://example.org/mynamespace">
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">
        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="A.xsd">
        </xsd:import>
        <xsd:element name="ElementOfTypeA" type="AType">
        </xsd:element>
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="ElFromA" ref="A:AElement"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2">
        <xsd:import namespace="http://example.org/mynamespace"/>
        <xsd:element name="ElOfTypeA" type="A:AType"/> <!-- This is valid since the namespace is imported here -->
        <xsd:complexType name="AnotherComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="test:MyComplexType"/> <!-- This is invalid since the namespace is not imported here -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="A:AType">
        </wsdl:part>
        <wsdl:part name="DefaultInput2" element="A:AElement">
        </wsdl:part>
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput" type="test:MyComplexType">
        </wsdl:part>
        <wsdl:part name="DefaultOutput2" element="test:ElementOfTypeA">
        </wsdl:part>
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request">
        </wsdl:input>
        <wsdl:output message="tns:Response">
        </wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type="tns:sample_wsdl_import_xsdPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding="tns:sample_wsdl_import_xsdSOAPBinding">
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>

    • Types, elements, attributes and groups defined in imported XSD file should be visible in <wsdl:part> section of <wsdl:message> if the namespace of imported XSD file is declared as attribute of <wsdl:definitions>

      • Example

        A.xsd
        <?xml version="1.0"?>

        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        targetNamespace="http://example.org/mynamespace"

        xmlns="http://example.org/mynamespace">

        <xsd:element name="AElement" type="AType"/>

        <xsd:complexType name="AType">

        <xsd:sequence>

        <xsd:element name="elStr" type="xsd:string"/>

        <xsd:element name="elInt" type="xsd:int"/>

        </xsd:sequence>

        </xsd:complexType>

        </xsd:schema>


        A.wsdl
        <?xml version="1.0" encoding="UTF-8"?>

        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"

        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"

        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">

        <wsdl:types>

        <xsd:schema elementFormDefault="qualified"

        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"

        xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">

        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="A.xsd"></xsd:import>

        <xsd:element name="ElementOfTypeA" type="AType"></xsd:element>

        <xsd:complexType name="MyComplexType">

        <xsd:sequence>

        <xsd:element name="streetNum" type="xsd:int"/>

        <xsd:element name="streetName" type="xsd:string"/>

        <xsd:element name="city" type="xsd:string"/>

        <xsd:element name="state" type="xsd:string"/>

        <xsd:element name="ElFromA" ref="A:AElement"/>

        </xsd:sequence>

        </xsd:complexType>

        </xsd:schema>

        <xsd:schema elementFormDefault="qualified"

        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"

        xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2"

        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">

        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="A.xsd"></xsd:import>

        <xsd:import namespace="urn:ESBP_TO_WSDL/esbp/test"/>

        <xsd:element name="ElOfTypeA" type="A:AType"></xsd:element>

        <xsd:complexType name="AnotherComplexType">

        <xsd:sequence>

        <xsd:element name="streetNum" type="xsd:int"/>

        <xsd:element name="streetName" type="xsd:string"/>

        <xsd:element name="city" type="xsd:string"/>

        <xsd:element name="state" type="test:MyComplexType"/>

        </xsd:sequence>

        </xsd:complexType>

        </xsd:schema>

        </wsdl:types>

        <wsdl:message name="Request">

        <wsdl:part name="DefaultInput" type="A:AType"></wsdl:part> <!-- This is not valid since namespace is not declared as attribute of wsdl:definitions -->

        <wsdl:part name="DefaultInput2" element="A:AElement"></wsdl:part><!-- This is not valid since namespace is not declared as attribute of wsdl:definitions -->



        </wsdl:message>

        <wsdl:message name="Response">

        <wsdl:part name="DefaultOutput"

        type="test:MyComplexType"></wsdl:part>

        <wsdl:part name="DefaultOutput2"

        element="test:ElementOfTypeA"></wsdl:part>

        <wsdl:part name="DefaultOutput3"

        type="test2:AnotherComplexType"></wsdl:part><!-- This is not valid since namespace is not declared as attribute of wsdl:definitions -->



        </wsdl:message>

        <wsdl:portType name="sample_wsdl_import_xsdPortType">

        <wsdl:operation name="sample_wsdl_import_xsd">

        <wsdl:input message="tns:Request"></wsdl:input>

        <wsdl:output message="tns:Response"></wsdl:output>

        </wsdl:operation>

        </wsdl:portType>

        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >

        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="sample_wsdl_import_xsd">

        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>

        <wsdl:input>

        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>

        </wsdl:input>

        <wsdl:output>

        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>

        </wsdl:output>

        </wsdl:operation>

        </wsdl:binding>

        <wsdl:service name="sample_wsdl_import_xsdService">

        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >

        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>

        </wsdl:port>

        </wsdl:service>

        </wsdl:definitions>


      • Above A.wsdl is not valid according to basic profile, to make above example correct as per basic profile please check the following example

        ValidA.wsdl
        <?xml version="1.0" encoding="UTF-8"?>

        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"

        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"

        xmlns:test="urn:ESBP_TO_WSDL/esbp/test"

        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2"

        xmlns:A="http://example.org/mynamespace">

        <wsdl:types>

        <xsd:schema elementFormDefault="qualified"

        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"

        xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">

        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="A.xsd"></xsd:import>

        <xsd:element name="ElementOfTypeA" type="AType"></xsd:element>

        <xsd:complexType name="MyComplexType">

        <xsd:sequence>

        <xsd:element name="streetNum" type="xsd:int"/>

        <xsd:element name="streetName" type="xsd:string"/>

        <xsd:element name="city" type="xsd:string"/>

        <xsd:element name="state" type="xsd:string"/>

        <xsd:element name="ElFromA" ref="A:AElement"/>

        </xsd:sequence>

        </xsd:complexType>

        </xsd:schema>

        <xsd:schema elementFormDefault="qualified"

        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"

        xmlns:xsd="http://www.w3.org/2001/XMLSchema"

        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2"

        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">

        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="A.xsd"></xsd:import>

        <xsd:import namespace="urn:ESBP_TO_WSDL/esbp/test"/>

        <xsd:element name="ElOfTypeA" type="A:AType"></xsd:element>

        <xsd:complexType name="AnotherComplexType">

        <xsd:sequence>

        <xsd:element name="streetNum" type="xsd:int"/>

        <xsd:element name="streetName" type="xsd:string"/>

        <xsd:element name="city" type="xsd:string"/>

        <xsd:element name="state" type="test:MyComplexType"/>

        </xsd:sequence>

        </xsd:complexType>

        </xsd:schema>

        </wsdl:types>

        <wsdl:message name="Request">

        <wsdl:part name="DefaultInput" type="A:AType"></wsdl:part><!-- This is valid since namespace is declared as attribute of wsdl:definitions -->

        <wsdl:part name="DefaultInput2" element="A:AElement"></wsdl:part><!-- This is valid since namespace is declared as attribute of wsdl:definitions -->

        </wsdl:message>

        <wsdl:message name="Response">

        <wsdl:part name="DefaultOutput"

        type="test:MyComplexType"></wsdl:part>

        <wsdl:part name="DefaultOutput2"

        element="test:ElementOfTypeA"></wsdl:part>

        <wsdl:part name="DefaultOutput3"

        type="test2:AnotherComplexType"></wsdl:part><!-- This is valid since namespace is declared as attribute of wsdl:definitions -->

        </wsdl:message>

        <wsdl:portType name="sample_wsdl_import_xsdPortType">

        <wsdl:operation name="sample_wsdl_import_xsd">

        <wsdl:input message="tns:Request"></wsdl:input>

        <wsdl:output message="tns:Response"></wsdl:output>

        </wsdl:operation>

        </wsdl:portType>

        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >

        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="sample_wsdl_import_xsd">

        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>

        <wsdl:input>

        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>

        </wsdl:input>

        <wsdl:output>

        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>

        </wsdl:output>

        </wsdl:operation>

        </wsdl:binding>

        <wsdl:service name="sample_wsdl_import_xsdService">

        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >

        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>

        </wsdl:port>

        </wsdl:service>

        </wsdl:definitions>

    • Types, elements, attributes and groups defined in nested imported XSD file should not be visible inside same <schema> section of <wsdl:types> as well as inside <wsdl:part> section of <wsdl:message>

      • Example


      • A.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespaceA">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        B.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespaceB"
        xmlns:A=”http://example.org/mynamespaceA”>
        <xsd:import namespace=”http://example.org/mynamespaceA”
        schemaLocation="A.xsd"/>
        <xsd:element name="BAElement" type="BType"/>
        <xsd:element name="AElementInsideB" type="AType"/>
        <xsd:complexType name="BType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        NestedInvalid.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:B="http://example.org/mynamespaceB">
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">
        <xsd:import namespace="http://example.org/mynamespaceB" schemaLocation="B.xsd"></xsd:import>
        <xsd:element name="ElementOfTypeA" type="AType"></xsd:element>
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="ElFromA" ref="AElement"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput"
        type="A:AType"></wsdl:part><!-- This is invalid use of type since this is from A.xsd the nested imported file-->

        <wsdl:part name="DefaultInput2"
        element="A:AElement"></wsdl:part><!-- This is invalid use of element since this is from A.xsd the nested imported file-->

        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput"
        type="test:MyComplexType"></wsdl:part>
        <wsdl:part name="DefaultOutput2"
        element="test:ElementOfTypeA"></wsdl:part> <!-- This is invalid use of element since this is from A.xsd the nested imported file-->
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>

  3. Including XSD document using <xsd:include> within <xsd:schema> section of <wsdl:types>

    • Types, elements, attributes and groups defined in included XSD document should be visible inside same <xsd:schema> section of <wsdl:types>

      • Example

        A.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema><?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        B.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:include schemaLocation="A.xsd"/>
        <xsd:element name="BAElement" type="BType"/>
        <xsd:element name="AElementInsideB" type="AType"/>
        <xsd:complexType name="BType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        Sample.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:B="http://example.org/mynamespace">
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="http://example.org/mynamespace"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:B="http://example.org/mynamespace">
        <xsd:include schemaLocation="B.xsd"></xsd:import>
        <xsd:element name="ElementOfTypeA" type="B:AType"></xsd:element><!-- This is nested element type from A.xsd -->
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="ElFromA" ref="B:BElement"/> <!-- This is included element from B.xsd -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="B:BType"></wsdl:part><!-- This is included type from B.xsd -->
        <wsdl:part name="DefaultInput2" element="B:AElement"></wsdl:part><!-- This is nested included element from A.xsd -->
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput"
        type="B:MyComplexType"></wsdl:part>
        <wsdl:part name="DefaultOutput2"
        element="B:ElementOfTypeA"></wsdl:part>
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>

    • Types, elements, attributes and groups defined in included XSD document should not be visible inside another <xsd:schema> section of <wsdl:types> unless it is explicitly imported in that <xsd:schema> schema section

      • Example

        A.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema><?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:element name="AElement" type="AType"/>
        <xsd:complexType name="AType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        B.xsd
        <?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://example.org/mynamespace"
        xmlns="http://example.org/mynamespace">
        <xsd:include schemaLocation="A.xsd"/>
        <xsd:element name="BAElement" type="BType"/>
        <xsd:element name="AElementInsideB" type="AType"/>
        <xsd:complexType name="BType">
        <xsd:sequence>
        <xsd:element name="elStr" type="xsd:string"/>
        <xsd:element name="elInt" type="xsd:int"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>


        Sample.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:B="http://example.org/mynamespace">
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace=" http://example.org/mynamespace "
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:B=" http://example.org/mynamespace ">
        <xsd:import namespace="http://example.org/mynamespace" schemaLocation="B.xsd"></xsd:import>
        <xsd:element name="ElementOfTypeA" type="B:AType"></xsd:element><!-- This is nested type from A.xsd -->
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="ElFromA" ref="B:BElement"/> <!-- This is included element from B.xsd -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test="urn:ESBP_TO_WSDL/esbp/test">
        <xsd:element name="ElementOfTypeA" type="B:AType"></xsd:element><!-- This is nested element type from A.xsd but it should not be visible in this schema section -->
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        <xsd:element name="ElFromA" ref="B:BElement"/> <!-- This is included element from B.xsd but this should not be visible here -->
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="B:BType"></wsdl:part><!-- This is included type from B.xsd -->
        <wsdl:part name="DefaultInput2" element="B:AElement"></wsdl:part><!-- This is nested included element from A.xsd -->
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput"
        type="test:MyComplexType"></wsdl:part>
        <wsdl:part name="DefaultOutput2"
        element="test:ElementOfTypeA"></wsdl:part>
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>


    • Types, elements, attributes and groups defined in included XSD document withing <xsd:schema> section of <wsdl:types> section, should be visible in <wsdl:part> section of <wsdl:message> if the namespace of included XSD document is declared as attribute of <wsdl:definitions>

      • Example: The previous example also explains this point

    • Types, elements, attributes and groups defined in nested included XSD document should be visible inside same <xsd:schema> section of <wsdl:types> as well as inside <wsdl:part> section of <wsdl:message> if included schema’s namespace is defined as attribute of <wsdl:definitions>

      • Example: The previous example also explains this point


  4. Visibility of types, elements, attributes and groups across multiple <xsd:schema> section of <wsdl:types> of WSDL document

    • Types, elements, attributes and groups defined in one <xsd:schema> inside <wsdl:types> should not be by default visible inside another <xsd:schema> section

      • Example

        Sample.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test1="urn:ESBP_TO_WSDL/esbp/test1"
        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2">
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test1"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test1="urn:ESBP_TO_WSDL/esbp/test1">
        <xsd:element name="MyComplexElement"
        type="test1:MyComplexType"></xsd:element>
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/> s
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test2"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2">
        <xsd:element name="MyElement" type="test1:MyComplexType" /><!-- This is not valid since namespace ("urn:ESBP_TO_WSDL/esbp/test1") of another schema section is not imported here -->
        <xsd:complexType name="AnotherCompleType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="test1:MyComplexType"></wsdl:part>
        <wsdl:part name="DefaultInput2" element="test1:MyComplexElement"></wsdl:part>
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput" type="test2:AnotherCompleType"></wsdl:part>
        <wsdl:part name="DefaultOutput2" element="test1:MyComplexElement"></wsdl:part>
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>

    • If the namespace of one <xsd:schema> section is imported inside another <xsd:schema> section of <wsdl:types> then all types, elements, attributes and groups of the first <xsd:schema> section as well as included types, elements, attributes and groups should be visible inside another <xsd:schema> section of<wsdl:types> but imported types inside first <xsd:schema> section should not be visible in the another <xsd:schema> section

      • Example

        Sample.wsdl
        <?xml version="1.0" encoding="UTF-8"?>
        <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        targetNamespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd"
        xmlns:test1="urn:ESBP_TO_WSDL/esbp/test1"
        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2">
        <wsdl:types>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test1"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test1="urn:ESBP_TO_WSDL/esbp/test1">
        <xsd:element name="MyComplexElement"
        type="test1:MyComplexType"></xsd:element>
        <xsd:complexType name="MyComplexType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        <xsd:schema elementFormDefault="qualified"
        targetNamespace="urn:ESBP_TO_WSDL/esbp/test2"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:test2="urn:ESBP_TO_WSDL/esbp/test2"
        xmlns:test1="urn:ESBP_TO_WSDL/esbp/test1">
        <xsd:import namespace="urn:ESBP_TO_WSDL/esbp/test1"/>
        <xsd:element name="MyElement" type="test1:MyComplexType" /><!-- This is valid since namespace ("urn:ESBP_TO_WSDL/esbp/test1") of another schema section is explicitly imported and hence visible over here -->
        <xsd:complexType name="AnotherCompleType">
        <xsd:sequence>
        <xsd:element name="streetNum" type="xsd:int"/>
        <xsd:element name="streetName" type="xsd:string"/>
        <xsd:element name="city" type="xsd:string"/>
        <xsd:element name="state" type="xsd:string"/>
        </xsd:sequence>
        </xsd:complexType>
        </xsd:schema>
        </wsdl:types>
        <wsdl:message name="Request">
        <wsdl:part name="DefaultInput" type="test1:MyComplexType"></wsdl:part>
        <wsdl:part name="DefaultInput2" element="test1:MyComplexElement"></wsdl:part>
        </wsdl:message>
        <wsdl:message name="Response">
        <wsdl:part name="DefaultOutput" type="test2:AnotherCompleType"></wsdl:part>
        <wsdl:part name="DefaultOutput2" element="test1:MyComplexElement"></wsdl:part>
        </wsdl:message>
        <wsdl:portType name="sample_wsdl_import_xsdPortType">
        <wsdl:operation name="sample_wsdl_import_xsd">
        <wsdl:input message="tns:Request"></wsdl:input>
        <wsdl:output message="tns:Response"></wsdl:output>
        </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="sample_wsdl_import_xsdSOAPBinding" type='tns:sample_wsdl_import_xsdPortType' >
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="sample_wsdl_import_xsd">
        <soap:operation soapAction="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd:sample_wsdl_import_xsdPortType:sample_wsdl_import_xsdRequest"/>
        <wsdl:input>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:input>
        <wsdl:output>
        <soap:body namespace="urn:ESBP_TO_WSDL/xsd/SampleWSDLS/sample_wsdl_import_xsd" use="literal"/>
        </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="sample_wsdl_import_xsdService">
        <wsdl:port name="sample_wsdl_import_xsdPort" binding='tns:sample_wsdl_import_xsdSOAPBinding' >
        <soap:address location="http://localhost:2580/process/sample_wsdl_import_xsd"/>
        </wsdl:port>
        </wsdl:service>
        </wsdl:definitions>






References:
http://www.ws-i.org