Package org.apache.xmlrpc.server

Examples of org.apache.xmlrpc.server.XmlRpcServer


    private static final int port = 8080;

    public static void main(String[] args) throws Exception {
        WebServer webServer = new WebServer(port);

        XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();

        PropertyHandlerMapping phm = new PropertyHandlerMapping();
        /*
         * Load handler definitions from a property file.
         * The property file might look like:
         * Calculator=org.apache.xmlrpc.demo.Calculator
         * org.apache.xmlrpc.demo.proxy.Adder=org.apache.xmlrpc.demo.proxy.AdderImpl
         */
        phm.load(Thread.currentThread().getContextClassLoader(), "org/apache/xmlrpc/webserver/XmlRpcServlet.properties");

        /*
         * You may also provide the handler classes directly, like this:
         * phm.addHandler("Calculator", org.apache.xmlrpc.demo.Calculator.class);
         * phm.addHandler(org.apache.xmlrpc.demo.proxy.Adder.class.getName(), org.apache.xmlrpc.demo.proxy.AdderImpl.class);
         */
        xmlRpcServer.setHandlerMapping(phm);

        XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
        serverConfig.setEnabledForExtensions(true);
        serverConfig.setContentLengthOptional(false);

        webServer.start();
    }
View Full Code Here


    return config;
  }

  protected void initWebServer() throws Exception {
    if (!isActive) {
      XmlRpcServer server = webServer.getXmlRpcServer();
      server.setHandlerMapping(mapping);
      XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) server.getConfig();
      serverConfig.setEnabledForExtensions(true);
      serverConfig.setContentLengthOptional(!contentLength);
            serverConfig.setEnabledForExceptions(true);
      webServer.start();
      isActive = true;
View Full Code Here

  protected ServletWebServerProvider(XmlRpcHandlerMapping pMapping, boolean pContentLength) throws ServletException, IOException {
    super(pMapping);
    contentLength = pContentLength;
    servlet = newXmlRpcServlet();
    webServer = new ServletWebServer(servlet, 0);
    XmlRpcServer server = servlet.getXmlRpcServletServer();
    server.setHandlerMapping(mapping);
    XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) server.getConfig();
    serverConfig.setEnabledForExtensions(true);
    serverConfig.setContentLengthOptional(!contentLength);
        serverConfig.setEnabledForExceptions(true);
    webServer.start();
    port = webServer.getPort();
View Full Code Here

            + "<methodCall><methodName>DateConverter.tomorrow</methodName>"
            + "<params><param><value><dateTime.iso8601>" + format.format(cal1.getTime())
            + "</dateTime.iso8601></value></param></params></methodCall>";
        assertEquals(expect, got);
       
        XmlRpcServer server = pProvider.getServer();
        server.setTypeFactory(getCustomDateTypeFactory(server, format));
        Date date = (Date) client.execute(request);
        Calendar cal2 = Calendar.getInstance();
        cal2.setTime(date);
        cal1.add(Calendar.DAY_OF_MONTH, 1);
        assertEquals(cal1, cal2);
View Full Code Here

            +   "<value>one</value></member>"
            + "</struct></value></param>"
            + "</params></methodCall>";
        assertEquals(expect, got);

        XmlRpcServer server = new XmlRpcServer();
        XmlRpcServerConfigImpl serverConfig = new XmlRpcServerConfigImpl();
        serverConfig.setEnabledForExtensions(true);
        server.setConfig(serverConfig);
        XmlRpcRequestParser parser = new XmlRpcRequestParser(serverConfig, new TypeFactoryImpl(server));
        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setValidating(false);
        spf.setNamespaceAware(true);
        XMLReader xr = spf.newSAXParser().getXMLReader();
View Full Code Here

  protected ClientProviderImpl(XmlRpcHandlerMapping pMapping) {
    mapping = pMapping;
  }

  protected XmlRpcServer getXmlRpcServer() throws Exception {
    XmlRpcServer server = new XmlRpcServer();
    server.setHandlerMapping(mapping);
    return server;
  }
View Full Code Here

       
    }
   
    private WebServer startXmlRpcWebServer () throws Exception {
        WebServer webServer = new WebServer(10301);       
        XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
        PropertyHandlerMapping phm = new PropertyHandlerMapping();
        phm.addHandler("Calculator", Calculator.class);
        phm.addHandler("EchoService", EchoService.class);
        xmlRpcServer.setHandlerMapping(phm);
       
        webServer.start();
        return webServer;
    }
View Full Code Here

  protected ServletWebServerProvider(XmlRpcHandlerMapping pMapping, boolean pContentLength) throws ServletException, IOException {
    super(pMapping);
    contentLength = pContentLength;
    servlet = new XmlRpcServlet();
    webServer = new ServletWebServer(servlet, 0);
    XmlRpcServer server = servlet.getXmlRpcServletServer();
    server.setHandlerMapping(mapping);
    XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) server.getConfig();
    serverConfig.setEnabledForExtensions(true);
    serverConfig.setContentLengthOptional(!contentLength);
    webServer.start();
    port = webServer.getPort();
   }
View Full Code Here

    return config;
  }

  protected void initWebServer() throws Exception {
    if (!isActive) {
      XmlRpcServer server = webServer.getXmlRpcServer();
      server.setHandlerMapping(mapping);
      XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) server.getConfig();
      serverConfig.setEnabledForExtensions(true);
      serverConfig.setContentLengthOptional(!contentLength);
      webServer.start();
      isActive = true;
    }
View Full Code Here

  }

  public XmlRpcController getController() { return factory.getController(); }

  public Object execute(XmlRpcRequest pRequest) throws XmlRpcException {
    XmlRpcServer server = (XmlRpcServer) getController();
    XmlRpcHandlerMapping mapping = server.getHandlerMapping();
    XmlRpcHandler handler = mapping.getHandler(pRequest.getMethodName());
    return handler.execute(pRequest);
  }
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.server.XmlRpcServer

Copyright © 2018 www.massapicom. 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.