org.apache.xmlrpc.client.XmlRpcClientException类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.apache.xmlrpc.client.XmlRpcClientException类的一些代码示例,展示了XmlRpcClientException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlRpcClientException类的具体详情如下:
包路径:org.apache.xmlrpc.client.XmlRpcClientException
类名称:XmlRpcClientException

XmlRpcClientException介绍

[英]This is thrown by many of the client classes if an error occured processing and XML-RPC request or response due to client side processing. This exception will wrap a cause exception in the JDK 1.4 style.

This class replaces the class org.apache.xmlrpc.XmlRpcClientException from Apache XML-RPC 2.0
[中]如果由于客户端处理而在处理XML-RPC请求或响应时发生错误,许多客户端类都会抛出该错误。此异常将以JDK 1.4样式包装一个原因异常。
该类将替换Apache XML-RPC 2.0中的类org.apache.xmlrpc.XmlRpcClientException

代码示例

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. protected InputStream getInputStream() throws XmlRpcException {
  2. try {
  3. return method.getResponseBodyAsStream();
  4. } catch (HttpException e) {
  5. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
  6. } catch (IOException e) {
  7. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e);
  8. }
  9. }

代码示例来源:origin: apache/cloudstack

  1. @Override
  2. protected Map dispatch(String methodcall, Object[] methodparams) throws XmlRpcException, XenAPIException {
  3. if (methodcall.equals("session.local_logout")
  4. || methodcall.equals("session.slave_local_login_with_password")
  5. || methodcall.equals("session.logout")
  6. || methodcall.equals("session.login_with_password")) {
  7. return super.dispatch(methodcall, methodparams);
  8. }
  9. try {
  10. return super.dispatch(methodcall, methodparams);
  11. } catch (Types.SessionInvalid e) {
  12. s_logger.debug("Session is invalid for method: " + methodcall + " due to " + e.toString());
  13. removeConnect(_poolUuid);
  14. throw e;
  15. } catch (XmlRpcClientException e) {
  16. s_logger.debug("XmlRpcClientException for method: " + methodcall + " due to " + e.toString());
  17. removeConnect(_poolUuid);
  18. throw e;
  19. } catch (XmlRpcException e) {
  20. s_logger.debug("XmlRpcException for method: " + methodcall + " due to " + e.toString());
  21. removeConnect(_poolUuid);
  22. throw e;
  23. } catch (Types.HostIsSlave e) {
  24. s_logger.debug("HostIsSlave Exception for method: " + methodcall + " due to " + e.toString());
  25. removeConnect(_poolUuid);
  26. throw e;
  27. }
  28. }
  29. }

代码示例来源:origin: org.codehaus.swizzle/swizzle-confluence

  1. private Object call(String command, Object[] args) throws SwizzleException {
  2. for (int i = 0; i < args.length; i++) {
  3. Object arg = args[i];
  4. if (arg instanceof MapObject) {
  5. MapObject map = (MapObject) arg;
  6. if (sendRawData) {
  7. args[i] = map.toRawMap();
  8. } else {
  9. args[i] = map.toMap();
  10. }
  11. }
  12. }
  13. Object[] vector;
  14. if (!command.equals("login")) {
  15. vector = new Object[args.length + 1];
  16. vector[0] = token;
  17. System.arraycopy(args, 0, vector, 1, args.length);
  18. } else {
  19. vector = args;
  20. }
  21. try {
  22. return client.execute("confluence2." + command, vector);
  23. } catch (XmlRpcClientException e) {
  24. throw new SwizzleException(e.getMessage(), e.linkedException);
  25. } catch (XmlRpcException e) {
  26. throw new ConfluenceException(e.getMessage(), e.linkedException);
  27. }
  28. }
  29. }

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. protected InputStream getInputStream() throws XmlRpcException {
  2. try {
  3. checkStatus(method);
  4. return method.getResponseBodyAsStream();
  5. } catch (HttpException e) {
  6. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
  7. } catch (IOException e) {
  8. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e);
  9. }
  10. }

代码示例来源:origin: rosjava/rosjava_core

  1. protected InputStream getInputStream() throws XmlRpcException {
  2. try {
  3. checkStatus(method);
  4. return method.getResponseBodyAsStream();
  5. } catch (HttpException e) {
  6. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
  7. } catch (IOException e) {
  8. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e);
  9. }
  10. }

代码示例来源:origin: rosjava/rosjava_core

  1. throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);

代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-client

  1. @Override
  2. protected InputStream getInputStream()
  3. throws XmlRpcException
  4. {
  5. try
  6. {
  7. client = builder.setHeaders( headers ).build();
  8. // Check the status of the return
  9. Response response = client.post( new ByteArrayBodyGenerator( byteOs.toByteArray() ) ).get();
  10. return response.getResponseBodyAsStream();
  11. }
  12. catch ( InterruptedException e )
  13. {
  14. throw new XmlRpcClientException( "Interruption during communication: " + e.getMessage(), e );
  15. }
  16. catch ( ExecutionException e )
  17. {
  18. throw new XmlRpcClientException( "Execution error during communication: " + e.getMessage(), e );
  19. }
  20. catch ( IOException e )
  21. {
  22. throw new XmlRpcClientException( "I/O error in server communication: " + e.getMessage(), e );
  23. }
  24. finally
  25. {
  26. byteOs.reset();
  27. }
  28. }

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. throw new XmlRpcClientException("Failed to read server response: " + e.getMessage(), e);

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. code = Integer.parseInt(statusCode);
  2. } catch (NumberFormatException e) {
  3. throw new XmlRpcClientException("Server returned invalid status code: "
  4. + statusCode + " " + statusMsg, null);
  5. throw new XmlRpcClientException("Failed to read server response: " + e.getMessage(), e);

代码示例来源:origin: rosjava/rosjava_core

  1. code = Integer.parseInt(statusCode);
  2. } catch (NumberFormatException e) {
  3. throw new XmlRpcClientException("Server returned invalid status code: "
  4. + statusCode + " " + statusMsg, null);
  5. throw new XmlRpcClientException("Failed to read server response: " + e.getMessage(), e);

代码示例来源:origin: stackoverflow.com

  1. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  2. } catch (IOException e) {
  3. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse servers response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read servers response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. } else {
  17. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  18. }
  19. }
  20. }

代码示例来源:origin: org.eclipse.mylyn.commons/xmlrpc

  1. @Override
  2. protected InputStream getInputStream() throws XmlRpcException {
  3. int responseCode = method.getStatusCode();
  4. if (responseCode != HttpURLConnection.HTTP_OK) {
  5. XmlRpcHttpException e = new XmlRpcHttpException(responseCode);
  6. if (responseCode == HttpStatus.SC_UNAUTHORIZED) {
  7. e.setAuthScheme(method.getHostAuthState().getAuthScheme());
  8. }
  9. throw e;
  10. }
  11. try {
  12. return method.getResponseBodyAsStream();
  13. } catch (HttpException e) {
  14. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); //$NON-NLS-1$
  15. } catch (IOException e) {
  16. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); //$NON-NLS-1$
  17. }
  18. }

代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-client

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. }
  17. Throwable t = xp.getErrorCause();
  18. if (t == null) {
  19. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  20. }
  21. if (t instanceof XmlRpcException) {
  22. throw (XmlRpcException) t;
  23. }
  24. if (t instanceof RuntimeException) {
  25. throw (RuntimeException) t;
  26. }
  27. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  28. }
  29. }

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. }
  17. Throwable t = xp.getErrorCause();
  18. if (t == null) {
  19. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  20. }
  21. if (t instanceof XmlRpcException) {
  22. throw (XmlRpcException) t;
  23. }
  24. if (t instanceof RuntimeException) {
  25. throw (RuntimeException) t;
  26. }
  27. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  28. }
  29. }

代码示例来源:origin: org.ogema.drivers/homematic-xmlrpc-ll

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. isource.setEncoding(pConfig.getEncoding()); //jl
  4. XMLReader xr = newXMLReader();
  5. XmlRpcResponseParser xp;
  6. try {
  7. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  8. xr.setContentHandler(xp);
  9. xr.parse(isource);
  10. } catch (SAXException e) {
  11. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  12. } catch (IOException e) {
  13. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  14. }
  15. if (xp.isSuccess()) {
  16. return xp.getResult();
  17. }
  18. Throwable t = xp.getErrorCause();
  19. if (t == null) {
  20. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  21. }
  22. if (t instanceof XmlRpcException) {
  23. throw (XmlRpcException) t;
  24. }
  25. if (t instanceof RuntimeException) {
  26. throw (RuntimeException) t;
  27. }
  28. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  29. }
  30. }

代码示例来源:origin: rosjava/rosjava_core

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. }
  17. Throwable t = xp.getErrorCause();
  18. if (t == null) {
  19. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  20. }
  21. if (t instanceof XmlRpcException) {
  22. throw (XmlRpcException) t;
  23. }
  24. if (t instanceof RuntimeException) {
  25. throw (RuntimeException) t;
  26. }
  27. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  28. }
  29. }

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. protected void setCredentials(XmlRpcHttpClientConfig pConfig)
  2. throws XmlRpcClientException {
  3. String auth;
  4. try {
  5. auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(),
  6. pConfig.getBasicPassword(),
  7. pConfig.getBasicEncoding());
  8. } catch (UnsupportedEncodingException e) {
  9. throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e);
  10. }
  11. if (auth != null) {
  12. setRequestHeader("Authorization", "Basic " + auth);
  13. }
  14. }

相关文章

XmlRpcClientException类方法