Hi Daniel,
 
This is a snapshot of your code from org.apache.axis.wsdlgen.Emitter class:
 
/** Create a PortType                                       
     *
     * @param def 
     * @param binding                       
     * @throws Exception
     */
    private void writePortType(Definition def, Binding binding) throws Exception{
 
        PortType portType = def.createPortType();
        portType.setUndefined(false);
 
        portType.setQName(new javax.wsdl.QName(intfNS, clsName + "PortType"));
 
        /** @todo should introduce allowInterfaces, to publish all methods from a interface */
        /** @todo if allowedMethods is specified always look for inherited methods as well?? */
        Method[] methods;
        if (useInheritedMethods & (allowedMethods != null) && (allowedMethods.trim().length() > 0))
          methods = cls.getMethods();
        else
          methods = cls.getDeclaredMethods();
 
        for(int i = 0, j = methods.length; i < j; i++) {
            if (allowedMethods != null) {
                if (allowedMethods.indexOf(methods[i].getName()) == -1)
                    continue;
            }
            Operation oper = writeOperation(def, binding, methods[i].getName());
            writeMessages(def, oper, methods[i]);
            portType.addOperation(oper);
        }
 
        def.addPortType(portType);
 
        binding.setPortType(portType);
    }
 
I want to ask a question about the for loop. In this for loop you are checking Methods name with indexOf method in String class (the red line). This method simply checks for an instance of String accurance in the main String object and returns the starting index of the string provided as a parameter. My queastion is: lets say there are two methods, one with the name foo() and another with the name foo1(). I just want method foo1 to be published as a webservice. But since your are itterating all the methods declared in the class, your code will publish both foo1() and foo() in the WSDL, since foo is a substring of foo1.
 
Please notify me if it is a bug, or you did it intentionally?
 
Best Regards
 
Ali
 
 

Reply via email to