You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/12/03 18:55:10 UTC

DO NOT REPLY [Bug 25170] New: - org.apache.axis.client.Service.getPorts does not return QName as per JAX-RPC spec, but java.lang.String instead

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25170>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25170

org.apache.axis.client.Service.getPorts does not return QName as per JAX-RPC spec, but java.lang.String instead

           Summary: org.apache.axis.client.Service.getPorts does not return
                    QName as per JAX-RPC spec, but java.lang.String instead
           Product: Axis
           Version: 1.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: WSDL processing
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: arh14@cornell.edu


Talked to TomJ about this in IRC, adding a bug for reference.  I'm not sure 
what category this belongs in but I can only pick one.

org.apache.axis.client.Service 'getPorts' method does not return an iteration 
of QNames as per the JAX-RPC spec ("Returns java.util.Iterator with elements of 
type javax.xml.namespace.QName").  Instead it directly propagates the iterator 
for the keySet() of the port map returned from WSDL4J 
javax.wsdl.Service.getPorts().  The keySet contains String keys, not QNames 
(see related bug about qualification and use of QNames with regard to Ports and 
HandlerRegistry in Axis).

The fix is to modify org.apache.axis.client.Service 'getPorts' method thusly 
(this will probably be badly mangled in bugzilla):

--- Copy of Service.java.bak	2003-06-13 10:47:02.000000000 -0400
+++ Service.java	2003-12-03 12:39:31.397125000 -0500
@@ -671,7 +671,27 @@
             // Return an empty iterator;
             return new Vector().iterator();
         }
-        return wsdlService.getPorts().keySet().iterator();
+
+        Map portmap = wsdlService.getPorts();
+        List portlist = new java.util.ArrayList(portmap.size());
+        // we could simply iterate over keys instead and skip
+        // the lookup, but while keys are probably the same as
+        // port names, the documentation does not make any
+        // guarantee on this, so we'll just play it safe
+        // Aaron Hamid
+        Iterator portiterator = portmap.values().iterator();
+        while (portiterator.hasNext()) {
+          Port port = (Port) portiterator.next();
+          // maybe we should use Definition.getTargetNamespace() here,
+          // but this class does not hold a reference to the object,
+          // so we'll just use the namespace of the service's QName
+          // (it should all be the same wsdl targetnamespace value, right?)
+          // Aaron Hamid
+          portlist.add(new QName(wsdlService.getQName().getNamespaceURI(), 
port.getName()));
+        }
+
+        // ok, return the real list of QNames
+        return portlist.iterator();
     }