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/03/17 14:32:37 UTC

DO NOT REPLY [Bug 18065] New: - initService ignores doc parameter

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=18065>.
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=18065

initService ignores doc parameter

           Summary: initService ignores doc parameter
           Product: Axis
           Version: current (nightly)
          Platform: Other
               URL: http://marc.theaimsgroup.com/?l=axis-
                    dev&m=104790429421850&w=2
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: WSDL processing
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: dims@yahoo.com


I think there's a bug in Service.java (RC2). The constructor

    public Service(InputStream wsdlInputStream, QName serviceName)
                           throws ServiceException {

doesn't set wsdlLocation, so initService() doesn't work. Also, it seems
strange that initService:

    private void initService(Document doc, QName serviceName)
            throws ServiceException {

Doesn't use its doc parameter at all. It just parses from wsdlLocation
and passes the parser and serviceLocation on to:

    private void initService(Parser parser, QName serviceName)
            throws ServiceException {

Below are the methods in question. Note how the first Service()
constructor sets wsdlLocation, but not the second:

/Daniel


------------------------

    /**
     * Constructs a new Service object for the service in the WSDL
document
     * pointed to by the wsdlLocation and serviceName parameters.  This
is
     * just like the previous constructor but instead of URL the
     * wsdlLocation parameter points to a file on the filesystem
relative
     * to the current directory.
     *
     * @param  wsdlLocation    Location of the WSDL relative to the
current dir
     * @param  serviceName     Qualified name of the desired service
     * @throws ServiceException If there's an error finding or parsing
the WSDL
     */
    public Service(String wsdlLocation, QName serviceName)
                           throws ServiceException {
        this.serviceName = serviceName;
        this.wsdlLocation = wsdlLocation;
        engine = getAxisClient();
        // Start by reading in the WSDL using Parser
        Parser parser = null ;
        if ( cachingWSDL &&
             (parser = (Parser) cachedWSDL.get(wsdlLocation)) != null )
{
          initService( parser, serviceName );
        }
        else {
            Document doc = null;
            try {
                doc = XMLUtils.newDocument(wsdlLocation);
            } catch (Exception exp ) {
                throw new ServiceException(
                   Messages.getMessage("wsdlError00", "" + "", "\n" +
exp) );
            }
          initService(doc, serviceName);
        }
    }

    /**
     * Constructs a new Service object for the service in the WSDL
document
     * in the wsdlInputStream and serviceName parameters.  This is
     * just like the previous constructor but instead of reading the
WSDL
     * from a file (or from a URL) it is in the passed in InputStream.
     *
     * @param  wsdlInputStream InputStream containing the WSDL
     * @param  serviceName     Qualified name of the desired service
     * @throws ServiceException If there's an error finding or parsing
the WSDL
     */
    public Service(InputStream wsdlInputStream, QName serviceName)
                           throws ServiceException {
        engine = getAxisClient();
        Document doc = null;
        try {
            doc = XMLUtils.newDocument(wsdlInputStream);
        } catch (Exception exp ) {
            throw new ServiceException(
               Messages.getMessage("wsdlError00", "" + "", "\n" + exp)
);
        }
        initService(doc, serviceName);
    }

    /**
     * Common code for building up the Service from a WSDL document
     *
     * @param doc               A DOM document containing WSDL
     * @param serviceName       Qualified name of the desired service
     * @throws ServiceException  If there's an error finding or parsing
the WSDL
     */
    private void initService(Document doc, QName serviceName)
            throws ServiceException {
        try {
            // Start by reading in the WSDL using Parser
            Parser parser = new Parser();
            parser.run(this.wsdlLocation.toString());

            if ( cachingWSDL && this.wsdlLocation != null )
              cachedWSDL.put( this.wsdlLocation.toString(), parser );

            initService( parser, serviceName );
        }
        catch( Exception exp ) {
            throw new ServiceException(
                    Messages.getMessage("wsdlError00", "" + "", "\n" +
exp) );
        }
    }

    private void initService(Parser parser, QName serviceName)
            throws ServiceException {
        try {
            this.wsdlParser = parser ;
            ServiceEntry serviceEntry =
parser.getSymbolTable().getServiceEntry(serviceName);
            if ( serviceEntry != null)
                this.wsdlService    = serviceEntry.getService(); 
            if ( this.wsdlService == null )
                throw new ServiceException(
                        Messages.getMessage("noService00", "" +
serviceName));
        }
        catch( Exception exp ) {
            throw new ServiceException(
                    Messages.getMessage("wsdlError00", "" + "", "\n" +
exp) );
        }
    }