XMLSchema cannot figure out external namespaces when the schema is read from an 
InputSource
-------------------------------------------------------------------------------------------

                 Key: WSCOMMONS-88
                 URL: http://issues.apache.org/jira/browse/WSCOMMONS-88
             Project: WS-Commons
          Issue Type: Bug
          Components: XmlSchema
         Environment: jdk 1.4
            Reporter: Oshani Seneviratne


The schema in question can be found in this WSDL:

http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/Chameleon-2G/getBalance.wsdl

This is what I do to read the schema:

       org.xml.sax.InputSource schemaInputSource = //Schema portion from the 
WSDL
       XmlSchemaCollection xsc = new XmlSchemaCollection();
       xsc.setBaseUri( baseURIOfWSDL );

       XmlSchema schemaDef = new XmlSchema(xsc);

       //Set the namespaces explicitly
       NamespaceMap prefixmap = new NamespaceMap( namespaceMapFromWSDL );
       schemaDef.setNamespaceContext(prefixmap);

       schemaDef = xsc.read ( schemaInputSource , null );


Which results in the following runtime error:

Exception in thread "main" java.lang.IllegalStateException: The prefix tns is 
not bound.
       at 
org.apache.ws.commons.schema.SchemaBuilder.getRefQName(SchemaBuilder.java:515)
       at 
org.apache.ws.commons.schema.SchemaBuilder.getRefQName(SchemaBuilder.java:496)
       at 
org.apache.ws.commons.schema.SchemaBuilder.handleElement(SchemaBuilder.java:1390)
       at 
org.apache.ws.commons.schema.SchemaBuilder.handleSequence(SchemaBuilder.java:956)
       at 
org.apache.ws.commons.schema.SchemaBuilder.handleComplexType(SchemaBuilder.java:584)
       at 
org.apache.ws.commons.schema.SchemaBuilder.handleElement(SchemaBuilder.java:1417)
       at 
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:143)
       at 
org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:67)
       at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:294)
       at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:286)
       at 
org.apache.woden.internal.OMWSDLReader.parseSchemaInline(OMWSDLReader.java:1211)
       at 
org.apache.woden.internal.OMWSDLReader.parseTypes(OMWSDLReader.java:245)
       at 
org.apache.woden.internal.OMWSDLReader.parseDescription(OMWSDLReader.java:163)
       at org.apache.woden.internal.OMWSDLReader.readWSDL(OMWSDLReader.java:103)
       at WSDLReader.main(WSDLReader.java:30)
.....

NOTE:
1. If the schema is read through an org.w3c.dom.Element, this problem doesn't 
occur.
2. This issue was not there when namespaces were registered in the 
XMLSchemaCollection object through the mapNamespaces method (which is now 
removed from the API).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to