protected InputStream getInputStream() throws XmlRpcException { try { return method.getResponseBodyAsStream(); } catch (HttpException e) { throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); } catch (IOException e) { throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); } }
throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);
throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);
protected InputStream getInputStream() throws XmlRpcException { try { checkStatus(method); return method.getResponseBodyAsStream(); } catch (HttpException e) { throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); } catch (IOException e) { throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); } }
protected InputStream getInputStream() throws XmlRpcException { try { checkStatus(method); return method.getResponseBodyAsStream(); } catch (HttpException e) { throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); } catch (IOException e) { throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); } }
@Override protected InputStream getInputStream() throws XmlRpcException { try { client = builder.setHeaders( headers ).build(); // Check the status of the return Response response = client.post( new ByteArrayBodyGenerator( byteOs.toByteArray() ) ).get(); return response.getResponseBodyAsStream(); } catch ( InterruptedException e ) { throw new XmlRpcClientException( "Interruption during communication: " + e.getMessage(), e ); } catch ( ExecutionException e ) { throw new XmlRpcClientException( "Execution error during communication: " + e.getMessage(), e ); } catch ( IOException e ) { throw new XmlRpcClientException( "I/O error in server communication: " + e.getMessage(), e ); } finally { byteOs.reset(); } }
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);
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()); } } }
@Override protected InputStream getInputStream() throws XmlRpcException { int responseCode = method.getStatusCode(); if (responseCode != HttpURLConnection.HTTP_OK) { XmlRpcHttpException e = new XmlRpcHttpException(responseCode); if (responseCode == HttpStatus.SC_UNAUTHORIZED) { e.setAuthScheme(method.getHostAuthState().getAuthScheme()); } throw e; } try { return method.getResponseBodyAsStream(); } catch (HttpException e) { throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); //$NON-NLS-1$ } catch (IOException e) { throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); //$NON-NLS-1$ } }
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); } }
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); } }
protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException { InputSource isource = new InputSource(pStream); isource.setEncoding(pConfig.getEncoding()); //jl 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); } }
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); } }
protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException { String auth; try { auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(), pConfig.getBasicPassword(), pConfig.getBasicEncoding()); } catch (UnsupportedEncodingException e) { throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e); } if (auth != null) { setRequestHeader("Authorization", "Basic " + auth); } }
protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException { String auth; try { auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(), pConfig.getBasicPassword(), pConfig.getBasicEncoding()); } catch (UnsupportedEncodingException e) { throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e); } if (auth != null) { setRequestHeader("Authorization", "Basic " + auth); } }
protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException { String auth; try { auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(), pConfig.getBasicPassword(), pConfig.getBasicEncoding()); } catch (UnsupportedEncodingException e) { throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e); } if (auth != null) { setRequestHeader("Authorization", "Basic " + auth); } }
protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException { String auth; try { auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(), pConfig.getBasicPassword(), pConfig.getBasicEncoding()); } catch (UnsupportedEncodingException e) { throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e); } if (auth != null) { setRequestHeader("Authorization", "Basic " + auth); } }
@Override protected void initHttpHeaders( XmlRpcRequest xmlRpcRequest ) throws XmlRpcClientException { if ( !XmlRpcClientConfigImpl.class.isAssignableFrom( xmlRpcRequest.getConfig().getClass() ) ) { throw new XmlRpcClientException( "Invalid XmlRpcRequest", null ); } XmlRpcClientConfigImpl config = XmlRpcClientConfigImpl.class.cast( xmlRpcRequest.getConfig() ); super.initHttpHeaders( xmlRpcRequest ); configureProxy( config ); configureTimeout( config ); if ( config.getSslContext() != null ) { builder.setSSLContext( config.getSslContext() ); } if (config.isGzipRequesting()) { builder.setRequestCompressionLevel(6); } builder.setUrl( config.getServerURL().toString() ).setFollowRedirects( config.isFollowRedirect() ); }
throw t; } catch (Throwable t) { throw new XmlRpcClientException("Failed to invoke method " + pRequest.getMethodName() + ": " + t.getMessage(), t);
throw t; } catch (Throwable t) { throw new XmlRpcClientException("Failed to invoke method " + pRequest.getMethodName() + ": " + t.getMessage(), t);