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

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

本文整理了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

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);
  }
}

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

@Override
  protected Map dispatch(String methodcall, Object[] methodparams)  throws XmlRpcException, XenAPIException {
    if (methodcall.equals("session.local_logout")
        || methodcall.equals("session.slave_local_login_with_password")
        || methodcall.equals("session.logout")
        || methodcall.equals("session.login_with_password")) {
      return super.dispatch(methodcall, methodparams);
    }
    try {
      return super.dispatch(methodcall, methodparams);
    } catch (Types.SessionInvalid e) {
      s_logger.debug("Session is invalid for method: " + methodcall + " due to " + e.toString());
      removeConnect(_poolUuid);
      throw e;
    } catch (XmlRpcClientException e) {
      s_logger.debug("XmlRpcClientException for method: " + methodcall + " due to " + e.toString());
      removeConnect(_poolUuid);
      throw e;
    } catch (XmlRpcException e) {
      s_logger.debug("XmlRpcException for method: " + methodcall + " due to " + e.toString());
      removeConnect(_poolUuid);
      throw e;
    } catch (Types.HostIsSlave e) {
       s_logger.debug("HostIsSlave Exception for method: " + methodcall + " due to " + e.toString());
       removeConnect(_poolUuid);
       throw e;
    }
  }
}

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

private Object call(String command, Object[] args) throws SwizzleException {
    for (int i = 0; i < args.length; i++) {
      Object arg = args[i];
      if (arg instanceof MapObject) {
        MapObject map = (MapObject) arg;
        if (sendRawData) {
          args[i] = map.toRawMap();
        } else {
          args[i] = map.toMap();
        }
      }
    }
    Object[] vector;
    if (!command.equals("login")) {
      vector = new Object[args.length + 1];
      vector[0] = token;
      System.arraycopy(args, 0, vector, 1, args.length);
    } else {
      vector = args;
    }
    try {
      return client.execute("confluence2." + command, vector);
    } catch (XmlRpcClientException e) {
      throw new SwizzleException(e.getMessage(), e.linkedException);
    } catch (XmlRpcException e) {
      throw new ConfluenceException(e.getMessage(), e.linkedException);
    }
  }
}

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

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

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

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

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

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);
  }
}

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

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);
  }
}

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

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

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

@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();
  }
}

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

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

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

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

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

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

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

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);

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

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());
    }
  }
}

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

@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$
  }
}

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

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);
  }
}

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

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);
  }
}

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

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);
  }
}

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

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);
  }
}

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

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);
  }
}

相关文章

XmlRpcClientException类方法