Search in sources :

Example 1 with XmlRpcRequestParser

use of org.apache.xmlrpc.parser.XmlRpcRequestParser in project camel by apache.

the class XmlRpcDataFormat method unmarshalRequest.

protected Object unmarshalRequest(Exchange exchange, InputStream stream) throws Exception {
    InputSource isource = new InputSource(stream);
    XMLReader xr = newXMLReader();
    XmlRpcRequestParser xp;
    try {
        xp = new XmlRpcRequestParser(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);
    }
    return new XmlRpcRequestImpl(xp.getMethodName(), xp.getParams());
}
Also used : XmlRpcRequestParser(org.apache.xmlrpc.parser.XmlRpcRequestParser) InputSource(org.xml.sax.InputSource) XmlRpcRequestImpl(org.apache.camel.component.xmlrpc.XmlRpcRequestImpl) XmlRpcClientException(org.apache.xmlrpc.client.XmlRpcClientException) IOException(java.io.IOException) XMLReader(org.xml.sax.XMLReader) SAXException(org.xml.sax.SAXException)

Aggregations

IOException (java.io.IOException)1 XmlRpcRequestImpl (org.apache.camel.component.xmlrpc.XmlRpcRequestImpl)1 XmlRpcClientException (org.apache.xmlrpc.client.XmlRpcClientException)1 XmlRpcRequestParser (org.apache.xmlrpc.parser.XmlRpcRequestParser)1 InputSource (org.xml.sax.InputSource)1 SAXException (org.xml.sax.SAXException)1 XMLReader (org.xml.sax.XMLReader)1