Package org.apache.xmlrpc

Examples of org.apache.xmlrpc.XmlRpcException


                        break;
                     buf.append(line).append("\n");
                  }
                  errStr.close();
                  if (buf.length() > 0) {
                     throw new XmlRpcException(errUrl.getResponseCode(), buf.toString(), e);
                  }
               }
            }
            catch (IOException ex) {
               ex.printStackTrace();
            }
         }
        
         throw new XmlRpcException("Failed to create input stream: " + e.getMessage(), e);
      }
   }
View Full Code Here


    log.debug(":: getXmlWriter ::");
   
    try {
      xw.setWriter(new BufferedWriter(new OutputStreamWriter(pStream, enc)));
    } catch (UnsupportedEncodingException e) {
      throw new XmlRpcException(0, "Unsupported encoding: " + enc + e);
    }
    return xw;
  }
View Full Code Here

    log.debug(":: getXmlWriter ::");
   
    try {
      xw.setWriter(new BufferedWriter(new OutputStreamWriter(pStream, enc)));
    } catch (UnsupportedEncodingException e) {
      throw new XmlRpcException(0, "Unsupported encoding: " + enc + e);
    }
    return xw;
  }
View Full Code Here

       
        Method method = lookupMethod( delegate, methodName, xmlRpcSignature );
       
        if( method.getDeclaringClass() == Object.class )
        {
            throw new XmlRpcException( 0, "Can't call methods defined in java.lang.Object" );
        }
       
        MethodSignature methodSig = MethodSignature.createFromMethod( method );
        Object[] adaptedParameters = adaptParameters( methodSig, args );
       
       
        Object result = method.invoke( delegate, adaptedParameters );
       
        //convert result back to a XML-RPC compliant representation
        result = getTypeConverter().convertToXmlRpcRepresentation( methodSig.getReturnParameter(), result );
       
        if (result == null && !methodSig.getReturnParameter().getApiRepresentationClass().equals( void.class ))
        {
            throw( new XmlRpcException( 0, "Method '" + method + "' must not return <null>" ) );
        }
       
        return( result );
    }
View Full Code Here

            AuthorizationResult result = authorize( session, method, username );
           
            return result.isAuthorized();
        }

        throw new XmlRpcException( "Unsupported transport (must be http)" );
    }
View Full Code Here

        {
            return securitySystem.authenticate( authenticationDataSource );
        }
        catch ( PolicyViolationException e )
        {
            throw new XmlRpcException( 401, e.getMessage(), e );
        }
        catch ( AuthenticationException e )
        {
            throw new XmlRpcException( 401, e.getMessage(), e );
        }
        catch ( UserNotFoundException e )
        {
            throw new XmlRpcException( 401, e.getMessage(), e );
        }
    }
View Full Code Here

                        return new AuthorizationResult( false, username, null );
                    }
                }
                catch ( ArchivaSecurityException e )
                {
                    throw new XmlRpcException( 401, e.getMessage() );
                }
            }
            else if ( methodName.equals( ServiceMethodsPermissionsMapping.PING ) )
            {
                return new AuthorizationResult( true, username, null );
            }
            else
            {
                return securitySystem.authorize( session, ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE );
            }
        }
        catch ( AuthorizationException e )
        {
            throw new XmlRpcException( 401, e.getMessage(), e );
        }
    }
View Full Code Here

        @Override
        public Object sendRequest(XmlRpcRequest req) throws XmlRpcException {
            XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) req.getConfig();
            URL serverUrl = config.getServerURL();
            if (serverUrl == null) {
                throw new XmlRpcException("Invalid server URL");
            }

            try {
                con = openConnection(serverUrl);
                con.setUseCaches(false);
                con.setDoInput(true);
                con.setDoOutput(true);
            } catch (IOException e) {
                throw new XmlRpcException("Failed to create URLConnection: " + e.getMessage(), e);
            }
            return super.sendRequest(req);
        }
View Full Code Here

        @Override
        protected InputStream getInputStream() throws XmlRpcException {
            try {
                return con.getInputStream();
            } catch (IOException e) {
                throw new XmlRpcException("Failed to create input stream: " + e.getMessage(), e);
            }
        }
View Full Code Here

            ModelService model;
            try {
                model = dispatcher.getDispatchContext().getModelService(xmlRpcReq.getMethodName());
            } catch (GenericServiceException e) {
                throw new XmlRpcException(e.getMessage(), e);
            }

            if (model != null && model.auth) {
                String username = config.getBasicUserName();
                String password = config.getBasicPassword();

                // check the account
                Map<String, Object> context = FastMap.newInstance();
                context.put("login.username", username);
                context.put("login.password", password);

                Map<String, Object> resp;
                try {
                    resp = dispatcher.runSync("userLogin", context);
                } catch (GenericServiceException e) {
                    throw new XmlRpcException(e.getMessage(), e);
                }

                if (ServiceUtil.isError(resp)) {
                    return false;
                }
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.XmlRpcException

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.