[jboss-user] [JBoss Web Services] - Re: How do I upgrade web service using WSDL with multiple schema namespaces?

Kelly Dolan do-not-reply at jboss.com
Wed May 23 16:10:13 EDT 2012


Kelly Dolan [https://community.jboss.org/people/kdolan1] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/737499#737499

--------------------------------------------------------------
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 http://my.company.com" ...>
<types>
    <schema targetNamespace=" http://my.company.com/types http://my.company.com/types"
            xmlns=" http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified">
    ...
    // define some simple and complex types in here
    ...
    </schema>
    <schema targetNamespace=" http://my.company.com/operations http://my.company.com/operations"
            xmlns=" http://www.w3.org/2001/XMLSchema 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 http://my.company.com" ...>
<types>
    <schema targetNamespace=" http://my.company.com http://my.company.com"
            xmlns=" http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified">
        <import namespace=" http://my.company.com/types http://my.company.com/types" schemaLocation="types.xsd">
        <import namespace=" http://my.company.com/operations 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 http://my.company.com/operations"
        xmlns=" http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema"
        xmlns:operations=" http://my.company.com/operations http://my.company.com/operations"
        xmlns:types=" http://my.company.com/types http://my.company.com/types"
        elementFormDefault="qualified">

  <import namespace=" http://my.company.com/types 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
[https://community.jboss.org/message/737499#737499]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120523/86958630/attachment-0001.html 


More information about the jboss-user mailing list