Examples of XFireFault


Examples of org.codehaus.xfire.fault.XFireFault

    }
    catch(XFireFault e){
      throw e;
    }
    catch(Throwable e){
      throw new XFireFault(e);
    }
  }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

         
          return m.invoke(serviceObject, newParams);
      }
      catch (IllegalArgumentException e)
      {
          throw new XFireFault("Illegal argument invoking '" + ServiceUtils.getMethodName(method) + "': " + e.getMessage(), e, XFireFault.SENDER);
      }
      catch (InvocationTargetException e)
      {
          final Throwable t = e.getTargetException();

          if (t instanceof XFireFault)
          {
              throw (XFireFault) t;
          }
          else if (t instanceof Exception)
          {
             
              Class[] exceptions = m.getExceptionTypes();
              for( int i=0;i<exceptions.length;i++){
                  ifexceptions[i].isAssignableFrom(t.getClass())){
                      throw new XFireFault(t, XFireFault.RECEIVER);
                  }
              }
             
              throw new XFireFault(t, XFireFault.SENDER);
          }
          else
          {
              throw new XFireRuntimeException("Error invoking '" + ServiceUtils.getMethodName(method) + '\'', e);
          }
      }
      catch (IllegalAccessException e)
      {
          throw new XFireFault("Couldn't access service object to invoke '" + ServiceUtils.getMethodName(method) + "': " + e.getMessage(), e, XFireFault.RECEIVER);
      }finally{
        tfContext.set(null);
      }
  }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

        {
            return locator.lookup(role);
        }
        catch (ComponentLookupException e)
        {
            throw new XFireFault("Couldn't find service object.", e, XFireFault.RECEIVER);
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

    this.local.set(service);
  }
  public Object create() throws XFireFault {
    final Service service = getService();
    if(service==null){
      throw new XFireFault("service not initialized yet!", XFireFault.RECEIVER);
    }
    try
    {
        Class svcClass = (Class) service.getProperty(service_class_key);

        if (svcClass == null)
        {
            svcClass = service.getServiceInfo().getServiceClass();
            if(svcClass.isInterface())
            {
                throw new XFireFault(service_class_key + " not set for interface '" + svcClass.getName() + "'", XFireFault.RECEIVER);
            }
        }
     
        if(svcClass.isInterface())
        {
            throw new XFireFault("Service class '" + svcClass.getName() + "' is an interface", XFireFault.RECEIVER);
        }
     
      if(Modifier.isAbstract(svcClass.getModifiers()))
      {
          throw new XFireFault("Service class '" + svcClass.getName() + "' is abstract", XFireFault.RECEIVER);
      }
        return svcClass.newInstance();
    }
    catch (InstantiationException e)
    {
        throw new XFireFault("Couldn't instantiate service object.", e, XFireFault.RECEIVER);
    }
    catch (IllegalAccessException e)
    {
        throw new XFireFault("Couldn't access service object.", e, XFireFault.RECEIVER);
    }
  }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

        for(Iterator iter = namespaces.iterator();iter.hasNext();){
          String ns = (String) iter.next();
          try {
        NamespaceHelper.getUniquePrefix(writer,ns, true);
      } catch (XMLStreamException e) {
         throw new XFireFault("Could not write to outgoing stream.", e, XFireFault.RECEIVER);
      }
        }
         
       
        for(Iterator itr = msgInfo.getMessageParts().iterator(); itr.hasNext();)
        {
            MessagePartInfo outParam = (MessagePartInfo) itr.next();

            try
            {
                Object value;
                if (client)
                    value = getClientParam(values, outParam, context);
                else
                    value = getParam(values, outParam, context);
               
                writeParameter(writer, context, value, outParam, getBoundNamespace(context, outParam));
            }
            catch (XMLStreamException e)
            {
                throw new XFireFault("Could not write to outgoing stream.", e, XFireFault.RECEIVER);
            }
           
            i++;
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

        Service endpoint = context.getService();
       
        DepthXMLStreamReader dr = new DepthXMLStreamReader(context.getInMessage().getXMLStreamReader());

        if ( !STAXUtils.toNextElement(dr) )
            throw new XFireFault("There must be a method name element.", XFireFault.SENDER);
       
        OperationInfo op = context.getExchange().getOperation();

        if (!isClientModeOn(context) && op == null)
        {
            op = endpoint.getServiceInfo().getOperation( dr.getLocalName() );
           
            if (op == null)
            {
                throw new XFireFault("Invalid operation: " + dr.getName(), XFireFault.SENDER);
            }

            setOperation(op, context);
        }
       
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

                    {
                        sendMessage(context, paramArray, operation, invoker);
                    }
                    catch (Exception e)
                    {
                        XFireFault fault = XFireFault.createFault(e);

                        try
                        {
                            context.getCurrentPipeline().pause();
                            context.setProperty(DefaultFaultHandler.EXCEPTION, fault);

                            context.getCurrentPipeline().handleFault(fault, context);
                           
                            context.getFaultHandler().invoke(context);
                        }
                        catch (Exception e1)
                        {
                            logger.warn("Error invoking fault handler.", e1);
                        }
                    }
                }
            };
           
            execute(runnable, context.getService(), operation);
        }
        catch (XFireRuntimeException e)
        {
            logger.warn("Error invoking service.", e);
            throw new XFireFault("Error invoking service" + (e.getMessage() != null ? ": " + e.getMessage() : ".") , e, XFireFault.SENDER);
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

       
        Object[] newParams = new Object[total];
        List parts = inMsg.getMessageParts();
       
        if (params.size() < parts.size())
            throw new XFireFault("Not enough message parts were received for the operation.", XFireFault.SENDER);
       
        for (int i = 0; i < parts.size(); i++)
        {
            MessagePartInfo part = (MessagePartInfo) parts.get(i);
            newParams[part.getIndex()] = params.get(i);
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

       
        List parameters = new ArrayList();
        DepthXMLStreamReader dr = new DepthXMLStreamReader(context.getInMessage().getXMLStreamReader());
       
        if ( !STAXUtils.toNextElement(dr) )
            throw new XFireFault("There must be a method name element.", XFireFault.SENDER);
       
        String opName = dr.getLocalName();
        if (isClientModeOn(context))
            opName = opName.substring(0, opName.lastIndexOf("Response"));
       
        OperationInfo operation = endpoint.getServiceInfo().getOperation( opName );

        if (operation == null)
            throw new XFireFault("Could not find operation: " + opName, XFireFault.SENDER);
       
        // Move from operation element to whitespace or start element
        nextEvent(dr);
       
        setOperation(operation, context);

        if (operation == null)
        {
            throw new XFireFault("Invalid operation.", XFireFault.SENDER);
        }

        Service service = context.getService();
       
        MessageInfo msg;
        if (isClientModeOn(context))
            msg = operation.getOutputMessage();
        else
            msg = operation.getInputMessage();
       
        while(STAXUtils.toNextElement(dr))
        {
            MessagePartInfo p = (MessagePartInfo) msg.getMessageParts().get(parameters.size());

            if (p == null)
            {
                throw new XFireFault("Parameter " + dr.getName() + " does not exist!",
                                     XFireFault.SENDER);
            }
           
            QName name;
            if (p.getSchemaType().isAbstract())
            {
                name = new QName(service.getTargetNamespace(), dr.getLocalName());
            }
            else
            {
                name = dr.getName();
            }
           
            if (!p.getName().equals(name))
            {
                throw new XFireFault("Parameter " + dr.getName() + " does not exist!",
                                     XFireFault.SENDER);
            }
           
            parameters.add( endpoint.getBindingProvider().readParameter(p, dr, context) );
        }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

            Document doc = builder.build(message.getXMLStreamReader());
            message.setBody(doc);
        }
        catch (XMLStreamException e)
        {
            throw new XFireFault("Couldn't parse message.", e, XFireFault.SENDER);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.