Example #1
0
  public void processEditServicePara(HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {
    String serviceName = req.getParameter("axisService");
    if (req.getParameter("changePara") != null) {
      AxisService service = configContext.getAxisConfiguration().getService(serviceName);
      if (service != null) {
        for (Parameter parameter : service.getParameters()) {
          String para = req.getParameter(serviceName + "_" + parameter.getName());
          service.addParameter(new Parameter(parameter.getName(), para));
        }

        for (Iterator<AxisOperation> iterator = service.getOperations(); iterator.hasNext(); ) {
          AxisOperation axisOperation = iterator.next();
          String op_name = axisOperation.getName().getLocalPart();

          for (Parameter parameter : axisOperation.getParameters()) {
            String para = req.getParameter(op_name + "_" + parameter.getName());

            axisOperation.addParameter(new Parameter(parameter.getName(), para));
          }
        }
      }
      res.setContentType("text/html");
      req.setAttribute("status", "Parameters Changed Successfully.");
      req.getSession().removeAttribute(Constants.SERVICE);
    } else {
      AxisService serviceTemp =
          configContext.getAxisConfiguration().getServiceForActivation(serviceName);
      if (serviceTemp.isActive()) {

        if (serviceName != null) {
          req.getSession()
              .setAttribute(
                  Constants.SERVICE, configContext.getAxisConfiguration().getService(serviceName));
        }
      } else {
        req.setAttribute(
            "status",
            "Service "
                + serviceName
                + " is not an active service"
                + ". \n Only parameters of active services can be edited.");
      }
    }
    renderView(SERVICE_PARA_EDIT_JSP_NAME, req, res);
  }
  private Method findOperation(AxisOperation op, Class implClass) throws AxisFault {

    Method method = (Method) (op.getParameterValue("myMethod"));

    if (method != null) return method;

    String methodName = op.getName().getLocalPart();

    try {

      // Looking for a method of the form "void method(OMElement)"

      method = implClass.getMethod(methodName, new Class[] {OMElement.class});

      //			if (1 == 1)
      //				throw new Exception("return type is " + method.getReturnType().getName() + "\n" +
      //						"methodName is " + methodName + "\n" +
      //						"class is " + implClass.getName());

      if (method.getReturnType().getName().equals("void")) {
        try {
          op.addParameter("myMethod", method);
        } catch (AxisFault axisFault) {
          throw AxisFault.makeFault(axisFault);
        }
        return method;
      }

    } catch (Exception e) {
      throw AxisFault.makeFault(e);
    }

    if (logger.isDebugEnabled()) {
      logger.debug("return class is " + method.getReturnType().getName());
    }

    return null;
  }
  private Method findOperation(AxisOperation op, Class implClass) {
    Method method = (Method) (op.getParameterValue("myMethod"));
    if (method != null && method.getDeclaringClass() == implClass) return method;

    String methodName = op.getName().getLocalPart();

    try {
      // Looking for a method of the form "OMElement method(OMElement)"
      method = implClass.getMethod(methodName, new Class[] {OMElement.class});
      if (method.getReturnType().equals(OMElement.class)) {
        try {
          op.addParameter("myMethod", method);
        } catch (AxisFault axisFault) {
          // Do nothing here
        }
        return method;
      }
    } catch (NoSuchMethodException e) {
      // Fault through
    }

    return null;
  }