Package org.apache.xmlrpc.parser

Examples of org.apache.xmlrpc.parser.XmlRpcResponseParser


            Writer w = new OutputStreamWriter(ostream, "UTF-8");
            w.write("<methodCall><methodName>" + XMLRPC115Handler.class.getName() + ".ping"
                    + "</methodName></methodCall>");
            w.close();
            InputStream istream = conn.getInputStream();
            XmlRpcResponseParser parser = new XmlRpcResponseParser((XmlRpcStreamRequestConfig) client.getClientConfig(), client.getTypeFactory());
            XMLReader xr = SAXParsers.newXMLReader();
            xr.setContentHandler(parser);
            xr.parse(new InputSource(istream));
            istream.close();
            assertTrue(parser.getResult() instanceof Object[]);
            assertEquals(0, ((Object[]) parser.getResult()).length);
        }
    }
View Full Code Here


    private Object parseResponse(InputSource isource) throws XmlRpcException,
            IOException, SAXException {
        XmlRpcStreamRequestConfig config = new XmlRpcClientConfigImpl();
    XmlRpcClient client = new XmlRpcClient();
    XmlRpcResponseParser parser = new XmlRpcResponseParser(config, client.getTypeFactory());
    XMLReader xr = SAXParsers.newXMLReader();
    xr.setContentHandler(parser);
        xr.parse(isource);
    Object o = parser.getResult();
    return o;
    }
View Full Code Here

  }

  protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
    InputSource isource = new InputSource(pStream);
    XMLReader xr = newXMLReader();
    XmlRpcResponseParser xp;
    try {
      xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
      xr.setContentHandler(xp);
      xr.parse(isource);
    } catch (SAXException e) {
      throw new XmlRpcClientException("Failed to parse servers response: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new XmlRpcClientException("Failed to read servers response: " + e.getMessage(), e);
    }
    if (xp.isSuccess()) {
      return xp.getResult();
    } else {
      throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
    }
  }
View Full Code Here

            Writer w = new OutputStreamWriter(ostream, "UTF-8");
            w.write("<methodCall><methodName>" + XMLRPC115Handler.class.getName() + ".ping"
                    + "</methodName></methodCall>");
            w.close();
            InputStream istream = conn.getInputStream();
            XmlRpcResponseParser parser = new XmlRpcResponseParser((XmlRpcStreamRequestConfig) client.getClientConfig(), client.getTypeFactory());
            XMLReader xr = SAXParsers.newXMLReader();
            xr.setContentHandler(parser);
            xr.parse(new InputSource(istream));
            istream.close();
            assertTrue(parser.getResult() instanceof Object[]);
            assertEquals(0, ((Object[]) parser.getResult()).length);
        }
    }
View Full Code Here

  }

  protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
    InputSource isource = new InputSource(pStream);
    XMLReader xr = newXMLReader();
    XmlRpcResponseParser xp;
    try {
      xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
      xr.setContentHandler(xp);
            xr.parse(isource);
    } catch (SAXException e) {
      throw new XmlRpcClientException("Failed to parse servers response: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new XmlRpcClientException("Failed to read servers response: " + e.getMessage(), e);
    }
    if (xp.isSuccess()) {
      return xp.getResult();
    }
    Throwable t = xp.getErrorCause();
        if (t == null) {
            throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
        }
        if (t instanceof XmlRpcException) {
            throw (XmlRpcException) t;
        }
        if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        }
        throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  }
View Full Code Here

    private Object parseResponse(InputSource isource) throws XmlRpcException,
            IOException, SAXException {
        XmlRpcStreamRequestConfig config = new XmlRpcClientConfigImpl();
    XmlRpcClient client = new XmlRpcClient();
    XmlRpcResponseParser parser = new XmlRpcResponseParser(config, client.getTypeFactory());
    XMLReader xr = SAXParsers.newXMLReader();
    xr.setContentHandler(parser);
        xr.parse(isource);
    Object o = parser.getResult();
    return o;
    }
View Full Code Here

  }

  protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
    InputSource isource = new InputSource(pStream);
    XMLReader xr = newXMLReader();
    XmlRpcResponseParser xp;
    try {
      xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
      xr.setContentHandler(xp);
      xr.parse(isource);
    } catch (SAXException e) {
      throw new XmlRpcClientException("Failed to parse servers response: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new XmlRpcClientException("Failed to read servers response: " + e.getMessage(), e);
    }
    if (xp.isSuccess()) {
      return xp.getResult();
    } else {
      throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
    }
  }
View Full Code Here

  }

  protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
    InputSource isource = new InputSource(pStream);
    XMLReader xr = newXMLReader();
    XmlRpcResponseParser xp;
    try {
      xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
      xr.setContentHandler(xp);
            xr.parse(isource);
    } catch (SAXException e) {
      throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
    }
    if (xp.isSuccess()) {
      return xp.getResult();
    }
    Throwable t = xp.getErrorCause();
        if (t == null) {
            throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
        }
        if (t instanceof XmlRpcException) {
            throw (XmlRpcException) t;
        }
        if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        }
        throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  }
View Full Code Here

    }
   
    protected Object unmarshalResponse(Exchange exchange, InputStream stream) throws Exception {
        InputSource isource = new InputSource(stream);
        XMLReader xr = newXMLReader();
        XmlRpcResponseParser xp;
        try {
            xp = new XmlRpcResponseParser(xmlRpcStreamRequestConfig, typeFactory);
            xr.setContentHandler(xp);
            xr.parse(isource);
        } catch (SAXException e) {
            throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
        } catch (IOException e) {
            throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
        }
        if (xp.isSuccess()) {
            return xp.getResult();
        }
        Throwable t = xp.getErrorCause();
        if (t == null) {
            throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
        }
        if (t instanceof XmlRpcException) {
            throw (XmlRpcException)t;
        }
        if (t instanceof RuntimeException) {
            throw (RuntimeException)t;
        }
        throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);

    }
View Full Code Here

  }

  protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
    InputSource isource = new InputSource(pStream);
    XMLReader xr = newXMLReader();
    XmlRpcResponseParser xp;
    try {
      xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
      xr.setContentHandler(xp);
            xr.parse(isource);
    } catch (SAXException e) {
      throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
    }
    if (xp.isSuccess()) {
      return xp.getResult();
    }
    Throwable t = xp.getErrorCause();
        if (t == null) {
            throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
        }
        if (t instanceof XmlRpcException) {
            throw (XmlRpcException) t;
        }
        if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        }
        throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  }
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.parser.XmlRpcResponseParser

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.