Examples of XmlRpcException


Examples of org.apache.xmlrpc.XmlRpcException

        protected Map<String, Object> getContext(XmlRpcRequest xmlRpcReq, String serviceName) throws XmlRpcException {
            ModelService model;
            try {
                model = dispatcher.getDispatchContext().getModelService(serviceName);
            } catch (GenericServiceException e) {
                throw new XmlRpcException(e.getMessage(), e);
            }

            // context placeholder
            Map<String, Object> context = FastMap.newInstance();

            if (model != null) {
                int parameterCount = xmlRpcReq.getParameterCount();

                // more than one parameter; use list notation based on service def order
                if (parameterCount > 1) {
                    int x = 0;
                    for (String name: model.getParameterNames("IN", true, true)) {
                        context.put(name, xmlRpcReq.getParameter(x));
                        x++;

                        if (x == parameterCount) {
                            break;
                        }
                    }

                // only one parameter; if its a map use it as the context; otherwise make sure the service takes one param
                } else if (parameterCount == 1) {
                    Object param = xmlRpcReq.getParameter(0);
                    if (param instanceof Map) {
                        context = checkMap(param, String.class, Object.class);
                    } else {
                        if (model.getDefinedInCount() == 1) {
                            String paramName = (String) model.getInParamNames().iterator().next();
                            context.put(paramName, xmlRpcReq.getParameter(0));
                        } else {
                            throw new XmlRpcException("More than one parameter defined on service; cannot call via RPC with parameter list");
                        }
                    }
                }

                // do map value conversions
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

        Iterator iter =  mock(Iterator.class);
        doReturn(iter).when(vms).iterator();
        when(iter.hasNext()).thenReturn(true).thenReturn(false);
        doReturn(vm).when(iter).next();
        VM.Record vmr = mock(VM.Record.class);
        when(vm.getRecord(conn)).thenThrow(new XmlRpcException("XmlRpcException"));
        when(vm.getRecord(conn)).thenReturn(vmr);
        vmr.powerState = Types.VmPowerState.RUNNING;
        vmr.residentOn = mock(Host.class);
        XenAPIObject object = mock(XenAPIObject.class);
        doReturn(new String("OpaqueRef:NULL")).when(object).toWireString();
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

    try {
      return callback.waitForResponse();
    } catch (TimingOutCallback.TimeoutException to) {
      throw to;
    } catch (Throwable e) {
      throw new XmlRpcException(-2, e.getMessage());
    } finally {
      long endTime = System.currentTimeMillis();
      float during = (endTime - startTime) / 1000; // in secs
      s_logger.debug("Ovm call " + method + " finished in " + during + " secs");
    }
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

    /**
     * Handler for {@link JiraTest#testXMLRPC113()}
     */
    public static class XMLRPC113HandlerImpl implements XMLRPC113Handler {
        public Object throwCode(int pCode) throws XmlRpcException {
            throw new XmlRpcException(pCode, "Message: " + pCode);
        }
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

   */
  public static XMLReader newXMLReader() throws XmlRpcException {
    try {
      return spf.newSAXParser().getXMLReader();
    } catch (ParserConfigurationException e) {
      throw new XmlRpcException("Unable to create XML parser: " + e.getMessage(), e);
    } catch (SAXException e) {
      throw new XmlRpcException("Unable to create XML parser: " + e.getMessage(), e);
    }
  }
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

                    }
                    return invoke(instance, methodData.method, args);
                }
            }
      }
      throw new XmlRpcException("No method matching arguments: " + Util.getSignature(args));
    }
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

    private Object invoke(Object pInstance, Method pMethod, Object[] pArgs) throws XmlRpcException {
        try {
          return pMethod.invoke(pInstance, pArgs);
      } catch (IllegalAccessException e) {
          throw new XmlRpcException("Illegal access to method "
                                    + pMethod.getName() + " in class "
                                    + clazz.getName(), e);
      } catch (IllegalArgumentException e) {
          throw new XmlRpcException("Illegal argument for method "
                                    + pMethod.getName() + " in class "
                                    + clazz.getName(), e);
      } catch (InvocationTargetException e) {
          Throwable t = e.getTargetException();
            if (t instanceof XmlRpcException) {
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

   * <code>org/apache/xmlrpc/webserver/XmlRpcServlet.properties</code>
   */
  protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() throws XmlRpcException {
    URL url = XmlRpcServlet.class.getResource("XmlRpcServlet.properties");
    if (url == null) {
      throw new XmlRpcException("Failed to locate resource XmlRpcServlet.properties");
    }
    try {
      return newPropertyHandlerMapping(url);
    } catch (IOException e) {
      throw new XmlRpcException("Failed to load resource " + url + ": " + e.getMessage(), e);
    }
  }
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

        data.getConnection().writeErrorHeader(data, pError, -1);
        super.writeError(pConfig, pStream, pError);
        pStream.flush();
      }
    } catch (IOException e) {
      throw new XmlRpcException(e.getMessage(), e);
    }
  }
View Full Code Here

Examples of org.apache.xmlrpc.XmlRpcException

        data.getConnection().writeResponseHeader(data, -1);
        super.writeResponse(pConfig, pStream, pResult);
        pStream.flush();
      }
    } catch (IOException e) {
      throw new XmlRpcException(e.getMessage(), e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.