Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5840

http-Transport: Request for static WSDL does not work with syntax "serviceName?wsdl"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.7.4
    • None
    • transports
    • None

    Description

      Since we upgraded our Axis2 framework from version 1.5.x to 1.7.4 it is no longer possible to get a static WSDL using the syntax <ServiceURL>?wsdl. Regardless of the location of the wsdl-file itself, the returned message is either an error text or a generated wsdl by Axis2 (if you turn the "useOriginalwsdl" parameter in the services.xml file to false). The cause of the bug is somewhere either in the AxisServlet or in the AxisService classes.

      First the request executes the AxisServlet.doGet(HttpServletRequest request,
      HttpServletResponse response) class:

      ... starting line number 275 ...
              if ((query != null) && new QueryStringParser(query).search(metadataQueryParamNames)) {
                  // handling meta data exchange stuff
                  agent.processListService(request, response);
              } else if (HttpUtils.endsWithIgnoreCase(requestURI , ".xsd") ||
                      HttpUtils.endsWithIgnoreCase(requestURI, ".wsdl")) {
                  agent.processExplicitSchemaAndWSDL(request, response);
      ...
      

      The "metadataQueryParameterNames" are ["wsdl","xsl","wsdl2","policy"], so the first if-branch is taken (unless you write <service-URL>/service-name.wsdl, then the first else statement is taken). The following code fragment is in the class ListingAgent (starting line 297):

          private void handleWSDLRequest(HttpServletRequest req,
                                         HttpServletResponse res,
                                         String url,
                                         AxisService axisService) throws IOException {
              if (!canExposeServiceMetadata(axisService)){
                  res.sendError(HttpServletResponse.SC_FORBIDDEN);
                  return;
              }
              OutputStream out = res.getOutputStream();
              res.setContentType("text/xml");
              String ip = extractHost(url);
              String wsdlName = getParamtereIgnoreCase(req , "wsdl");
      
              if (wsdlName != null && wsdlName.length()>0) {
                  axisService.printUserWSDL(out, wsdlName, ip);
              } else {
                  axisService.printWSDL(out, ip);
              }
          }
      

      Since there is no "wsdlName" in the GET-request, the else branch calls the 2 parameter "printWSDL" method in the AxisService class:

      	public void printWSDL(OutputStream out, String requestIP) throws AxisFault {
      		// If we're looking for pre-existing WSDL, use that.
      		if (isUseUserWSDL()) {
      			printUserWSDL(out, null, requestIP);
      			return;
      		}
      ...
      

      "useOriginalwsdl" is a parameter in the services.xml and is set to "true", therefor

      	public void printUserWSDL(OutputStream out, String wsdlName, String ip)
      			throws AxisFault {
      		Definition definition = null;
      		// first find the correct wsdl definition
      		Parameter wsdlParameter = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
      		if (wsdlParameter != null) {
      			definition = (Definition) wsdlParameter.getValue();
      		}
      
      		if (definition != null) {
      			try {
      				printDefinitionObject(getWSDLDefinition(definition, wsdlName),
      						out, ip);
      			} catch (WSDLException e) {
      				throw AxisFault.makeFault(e);
      			}
      		} else {
      			printWSDLError(out);
      		}
      
      	}
      

      is called.

      There seems to be no way, that

      getParameter(WSDLConstants.WSDL_4_J_DEFINITION)
      

      ever returns a not null "Parameter object" in this scenario, therefor the "printWSDLError()" is called and the error message is returned to the caller.

      This bug is easily reproducable in any scenario.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tkitz Thorsten Kitz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: