Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2132

WSDL document object generated by AxisServer can not be read successfully using WSDL4J API

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 1.2 Beta, 1.2RC1, 1.2RC2, 1.2RC3, 1.2
    • None
    • WSDL processing
    • None
    • Testing on windows 2000, tomcat 5.0.28 and 5.5.4, apache axis beta 2 and 1.2 GA

    Description

      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.

      Attachments

        1. UojDocumentService.xml
          30 kB
          xiao-fei song
        2. QSWSDLHandler.java
          13 kB
          xiao-fei song

        Activity

          People

            Unassigned Unassigned
            songxiaofei xiao-fei song
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: