Skip to main content

How to deal with unresolved xs:schema references in WSDL

Posted by vivekp on May 25, 2007 at 11:45 PM PDT

I have been thinking of writing this blog for quite sometime to the benefit
of those who have been having troubles importing WSDLs that references xs:schema
but do not have corresponding import for such entities. This causes wsimport
tool to report error. Mark from portal team reported the same issue while
importing Share Point services and also WSIT and other users have reported the
similar problems.

So this is what happens, when wsimport is run on a WSDL that references
xs:schema and does not provide a corresponding import:

wsimport  SecureConversation.wsdl

Gives the following error:

[ERROR] undefined element declaration 'xs:schema'

line 1 of
http://131.107.72.15/Security_WsSecurity_Service_Indigo/WSSecureConversation.svc?xsd=xsd0

To fix this, you would do two things

  • Run wsimport with -b option and pass the URL of
    XML Schema. This is to
    take care of missing import.
  • There are potential name conflicts in schema for schema. this was
    discussed

    here
    at length and Kohsuke has provided a JAXB

    customization
    to resolve such conflicts.

So your wsimport command will be

wsimport -b  http://www.w3.org/2001/XMLSchema.xsd  -b  customization.xjb  SecureConversation.wsdl

You can do the same with NB 5.5.1, you would need to provide local copies of
these schema and customization files. If you are facing this issue try it and
let us
know if you see any issue.