[
http://issues.apache.org/jira/browse/AXIS-2132?page=comments#action_12316724 ]
xiao-fei song commented on AXIS-2132:
-------------------------------------
Some more investigations have been made which reveal that the issue is caused
by the combination between axis and xerces xml parser. As I made some code like
below in QSWSDLHanderl.java:
private void printElement(Document wsdlDoc) {
Element element = wsdlDoc.getDocumentElement();
for(Element element1 = DOMUtils.getFirstChildElement(element); element1
!= null; element1 = DOMUtils.getNextSiblingElement(element1)) {
System.out.println("element1: " + element1.getNodeType() + " : " +
element1.getNodeName());
for(Element element2 = DOMUtils.getFirstChildElement(element1);
element2 != null; element2 = DOMUtils.getNextSiblingElement(element2)) {
System.out.println(" element2.class = " +
element2.getClass());
System.out.println(" getNamespaceURI =" +
element2.getNamespaceURI());
System.out.println(" getLocalName =" +
element2.getLocalName());
}
}
}
I found output in the log file:
ÆßÔÂ 26 14:26:02 2005: element1: 1 : wsdl:types
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.ElementImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =null
ÆßÔÂ 26 14:26:02 2005: getLocalName =null
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.ElementImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =null
ÆßÔÂ 26 14:26:02 2005: getLocalName =null
ÆßÔÂ 26 14:26:02 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
ÆßÔÂ 26 14:26:02 2005: element2.class = class
org.apache.xerces.dom.DeferredElementNSImpl
ÆßÔÂ 26 14:26:02 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 14:26:02 2005: getLocalName =part
...
Which means the "wsdl:types" parts of the document object is not
org.apache.xerces.dom.DeferredElementNSImpl but
org.apache.xerces.dom.ElementImpl. Since
org.apache.xerces.dom.ElementImpl#getLocalName() always return NULL, thus we
get this QName error in WSDL4J code. So, the question is, why the wsdl:types
part is not org.apache.xerces.dom.DeferredElementNSImpl while all the other
parts are?
When it comes that axis is working with crimson parser, I get below output:
ÆßÔÂ 26 15:01:48 2005: element1: 1 : wsdl:types
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =null
ÆßÔÂ 26 15:01:48 2005: getLocalName =schema
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =null
ÆßÔÂ 26 15:01:48 2005: getLocalName =schema
ÆßÔÂ 26 15:01:48 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element1: 1 : wsdl:message
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
ÆßÔÂ 26 15:01:48 2005: element2.class = class
org.apache.crimson.tree.ElementNode2
ÆßÔÂ 26 15:01:48 2005: getNamespaceURI =http://schemas.xmlsoap.org/wsdl/
ÆßÔÂ 26 15:01:48 2005: getLocalName =part
....
So that is no problem.
> WSDL document object generated by AxisServer can not be read successfully
> using WSDL4J API
> ------------------------------------------------------------------------------------------
>
> Key: AXIS-2132
> URL: http://issues.apache.org/jira/browse/AXIS-2132
> Project: Apache Axis
> Type: Bug
> Components: WSDL processing
> Versions: 1.2 Beta, 1.2RC1, 1.2RC2, 1.2RC3, 1.2
> Environment: Testing on windows 2000, tomcat 5.0.28 and 5.5.4, apache axis
> beta 2 and 1.2 GA
> Reporter: xiao-fei song
> Priority: Critical
>
> Our product relies on the feature that AxisServer can return WSDL document
> which we can process. Basically we do like below:
> AxisServer engine.generateWSDL(msgContext);
> Document wsdlDoc = (Document) msgContext.getProperty("WSDL");
> And, the wsdlDoc is the org.w3c.dom.Document type which is what we want. And
> we have a simple class which processes the wsdl document like below:
> public class WSDLUtils {
> private static WSDLReader _wsdlReader = null;
> public WSDLUtils()
> throws WSDLException {
> if (_wsdlReader == null) {
> WSDLFactory factory = WSDLFactory.newInstance();
> _wsdlReader = factory.newWSDLReader();
> }
> }
> public WSDLReader getWSDLReader() {
> return _wsdlReader;
> }
> public Definition getWSDLDefinition(Document wsdlDoc)
> throws WSDLException {
> WSDLReader reader = getWSDLReader();
> return reader.readWSDL(null, wsdlDoc);
> }
> }
> And everytime we run this, we get the exception like this:
> July21 11:42:45 2005: [Thread-18] java.lang.IllegalArgumentException: local
> part cannot be "null" when creating a QName
> July21 11:42:45 2005: [Thread-18] at
> javax.xml.namespace.QName.<init>(QName.java:123)
> July21 11:42:45 2005: [Thread-18] at
> javax.xml.namespace.QName.<init>(QName.java:89)
> July21 11:42:45 2005: [Thread-18] at
> com.ibm.wsdl.util.xml.QNameUtils.newQName(Unknown Source)
> July21 11:42:45 2005: [Thread-18] at
> com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
> July21 11:42:45 2005: [Thread-18] at
> com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
> July21 11:42:45 2005: [Thread-18] at
> com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
> July21 11:42:45 2005: [Thread-18] at
> com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
> July21 11:42:45 2005: [Thread-18] at
> com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
> July21 11:42:45 2005: [Thread-18] at
> org.apache.axis.transport.http.QSWSDLHandler.invoke(QSWSDLHandler.java:83)
> July21 11:42:45 2005: [Thread-18] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> July21 11:42:45 2005: [Thread-18] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> July21 11:42:45 2005: [Thread-18] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> July21 11:42:45 2005: [Thread-18] at
> java.lang.reflect.Method.invoke(Method.java:324)
> July21 11:42:45 2005: [Thread-18] at
> org.apache.axis.transport.http.AxisServlet.processQuery(AxisServlet.java:1310)
> July21 11:42:45 2005: [Thread-18] at
> org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:261)
> July21 11:42:45 2005: [Thread-18] at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> July21 11:42:45 2005: [Thread-18] at
> org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:373)
> July21 11:42:45 2005: [Thread-18] at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> So I decided to test on axis itself and after modified
> org.apache.axis.transport.http.QSWSDLHandler#invoke() method add lines like
> below (line 74)
> try {
> //beginning of test
> WSDLFactory wsdlFactory = WSDLFactory.newInstance();
> WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
> wsdlReader.setFeature("javax.wsdl.verbose", true);
> Definition definition = wsdlReader.readWSDL(null, wsdlDoc);
> System.out.println("definition = " + definition);
> //end of test
> } catch (Exception e) {
> e.printStackTrace();
> }
> And compile axis and test
> http://localhost:8080/axis/services/AdminService?wsdl to invoke the method
> above, and I saw exactly the same exception in the console, which means that
> the wsdl document object returned by AxisServer.generateWSDL() can not be
> processed by WSDL4J API.
> Couple of others:
> 1. the tests failed in 1.2 beta2 and 1.2GA, so it should not be a problem of
> WSDL4J
> 2. http://localhost:8080/axis/services/Version?wsdl works okay in beta and GA
> 3. I wrote test case like below:
> public static Definition testA() {
> Definition definition = null;
> try {
> String filename = "d:/dl/UojDocumentService.xml";
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> /*note*/ dbf.setNamespaceAware(true);
> DocumentBuilder db = dbf.newDocumentBuilder();
> FileInputStream fis = new FileInputStream(new File(filename));
> InputSource inp = new InputSource(fis);
>
> Document doc = db.parse(inp);
> System.out.println("doc = " + doc);
>
> WSDLFactory wsdlFactory = WSDLFactory.newInstance();
> WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
> definition = wsdlReader.readWSDL(null, doc);
> System.out.println("definition = " + definition);
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> return definition;
> }
> After saving the wsdl as the xml file on disk, the code above runs okay. But
> if I didn't run /*note*/ dbf.setNamespaceAware(true); I get similar exception
> as above.
> 3. running WSDL4J process the wsdl online runs okay so the problem has to be
> in the docuemnt object rather than the xml document.
--
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