JBoss Community

Re: How do I upgrade web service using WSDL with multiple schema namespaces?

created by Kelly Dolan in JBoss Web Services - View the full discussion

Ok, I found some help elsewhere, got something to work so I'm posting my solution for anyone else who might run into the same issue and confusion.

 

My solution was not to split the WSDL but to split THE SCHEMA defined in the WSDL.  So instead of having...

 

<definitions targetNamespace="http://my.company.com" ...>

<types>

    <schema targetNamespace="http://my.company.com/types"

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

            elementFormDefault="qualified">

    ...

    // define some simple and complex types in here

    ...

    </schema>

    <schema targetNamespace="http://my.company.com/operations"

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

            elementFormDefault="qualified">

    ...

    // define some simple and complex types in here

    ...

    </schema>

</types>

...

 

 

...I now have...

 

 

// my wsdl file

<definitions targetNamespace="http://my.company.com" ...>

<types>

    <schema targetNamespace="http://my.company.com"

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

            elementFormDefault="qualified">

        <import namespace="http://my.company.com/types" schemaLocation="types.xsd">

        <import namespace="http://my.company.com/operations" schemaLocation="operations.xsd">

    </schema>

</types>

...

 

 

// operations.xsd (whose types are dependent on types.xsd)

<schema targetNamespace="http://my.company.com/operations"

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

        xmlns:operations="http://my.company.com/operations"

        xmlns:types="http://my.company.com/types"

        elementFormDefault="qualified">

 

  <import namespace="http://my.company.com/types" schemaLocation="types.xsd"/>

 

  // define some simple and complex types in here           

     

</schema>

 

 

Steps for creating the XSD files:

1. For each schema in the WSDL, create an XSD file

2. The root <schema> element target namespace is the unique namespace for the simple/complex types it defines

3. Copied <schema> children as-is from WSDL to XSD file

4. If the new XSD file referenced one of the other namespaces, add a namespace declaration in <schema> for it and added an <import>

5. For each <import>, the namespace is the unique namespace for the simple/complex types the imported file defines

 

Steps for modifying the WSDL file:

1. Remove all but one <schema> element

2. Change the <schema> target namespace to the same target namespace for <definitions>

3. Add an <import> for each XSD file (i.e., original <schema> element)

4. For each <import>, the namespace is the unique namespace for the simple/complex types the imported file defines

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community