Examples of XFireFault


Examples of org.codehaus.xfire.fault.XFireFault

            {
                STAXUtils.copy((XMLStreamReader) out.getBody(), writer);
            }
            catch (XMLStreamException e)
            {
                throw new XFireFault("Couldn't write to stream.", e, XFireFault.RECEIVER);
            }
        }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

           
            return parsed;
        }
        catch( XmlException e )
        {
            throw new XFireFault("Could not read request.", e, XFireFault.SENDER);
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

                                ((ElementWriter) writer).getXMLStreamWriter());
            }
        }
        catch (XMLStreamException e)
        {
            throw new XFireFault("Could not write response.", e, XFireFault.SENDER);
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

    public void invoke(MessageContext context)
        throws Exception
    {
        Throwable e = (Throwable) context.getProperty(EXCEPTION);

        XFireFault fault = XFireFault.createFault(e);
       
        // get the root cause so we know what level to log
        if (fault.getCause() != null) e = fault.getCause();
       
        if (e instanceof RuntimeException)
        {
            log.error("Fault occurred!", e);
        }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

            faultPipe.invoke(context);
        }
        catch (Exception e1)
        {
            // An exception occurred while sending the fault. Log and move on.
            XFireFault fault2 = XFireFault.createFault(e1);
            faultPipe.handleFault(fault2, context);
           
            log.error("Could not send fault.", e1);
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

                 * encryption there is a specific parameter to get a username.
                 */
                if (reqData.getUsername() == null || reqData.getUsername().equals(""))
                {
                  log.error("WSDoAllSender: Empty username for specified action");
                    throw new XFireFault("WSDoAllSender: Empty username for specified action", XFireFault.RECEIVER);
                }
            }
            if (doDebug)
            {
                log.debug("Action: " + doAction);
                log.debug("Actor: " + reqData.getActor());
            }
            /*
             * Now get the SOAP part from the request message and convert it
             * into a Document.
             *
             * This forces Axis to serialize the SOAP request into FORM_STRING.
             * This string is converted into a document.
             *
             * During the FORM_STRING serialization Axis performs multi-ref of
             * complex data types (if requested), generates and inserts
             * references for attachements and so on. The resulting Document
             * MUST be the complete and final SOAP request as Axis would send it
             * over the wire. Therefore this must shall be the last (or only)
             * handler in a chain.
             *
             * Now we can perform our security operations on this request.
             */
            OutMessage message = (OutMessage) mc.getCurrentMessage();
            Document doc = (Document) message.getProperty(DOMOutHandler.DOM_MESSAGE);
            if( doc == null ){
              log.error("There is no DOM message in current message. Add DOMOutHandler to your handlers chain");
              throw new XFireFault("There is no DOM message in current message. Add DOMOutHandler to your handlers chain",XFireFault.RECEIVER);
            }
            /**
             * There is nothing to send...Usually happens when the provider
             * needs to send a HTTP 202 message (with no content)
             */
            if (message == null)
            {
                return;
            }

            if (tlog.isDebugEnabled())
            {
                t1 = System.currentTimeMillis();
            }

            doSenderAction(doAction, doc, reqData, actions, AbstractBinding.isClientModeOn(mc));

            if (tlog.isDebugEnabled())
            {
                t2 = System.currentTimeMillis();
            }

            if (tlog.isDebugEnabled())
            {
                t3 = System.currentTimeMillis();
                tlog.debug("Send request: total= " + (t3 - t0) + " request preparation= "
                        + (t1 - t0) + " request processing= " + (t2 - t1) + " request to Axis= "
                        + (t3 - t2) + "\n");
            }

            if (doDebug)
            {
                log.debug("WSDoAllSender: exit invoke()");
            }
        }
        catch (WSSecurityException e)
        {
            throw new XFireFault(e.getMessage(), e, XFireFault.RECEIVER);
        }
        finally
        {
            reqData.clear();
            reqData = null;
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

                        .getSigCrypto(), reqData.getDecCrypto());
            }
            catch (WSSecurityException ex)
            {
              log.error(ex);
                throw new XFireFault("WSS4JInHandler: security processing failed", ex,
                        XFireFault.SENDER);
            }

            if (tlog.isDebugEnabled())
            {
                t2 = System.currentTimeMillis();
            }

            if (wsResult == null)
            { // no security header found
                if (doAction == WSConstants.NO_SECURITY)
                {
                    return;
                }
                else
                {
                    log.error("WSS4JInHandler: Request does not contain required Security header");
                    throw new XFireFault(
                            "WSS4JInHandler: Request does not contain required Security header",
                            XFireFault.SENDER);
                }
            }

            if (reqData.getWssConfig().isEnableSignatureConfirmation())
            {
                checkSignatureConfirmation(reqData, wsResult);
            }

            /*
             * Now we can check the certificate used to sign the message. In the
             * following implementation the certificate is only trusted if
             * either it itself or the certificate of the issuer is installed in
             * the keystore.
             *
             * Note: the method verifyTrust(X509Certificate) allows custom
             * implementations with other validation algorithms for subclasses.
             */

            // Extract the signature action result from the action vector
            WSSecurityEngineResult actionResult = WSSecurityUtil
                    .fetchActionResult(wsResult, WSConstants.SIGN);

            if (actionResult != null)
            {
                X509Certificate returnCert = actionResult.getCertificate();

                if (returnCert != null)
                {
                    if (!verifyTrust(returnCert, reqData))
                    {
                        log.error("WSS4JInHandler: The certificate used for the signature is not trusted");
                        throw new XFireFault(
                                "WSS4JInHandler: The certificate used for the signature is not trusted",
                                XFireFault.SENDER);
                    }
                }
            }

            /*
             * Perform further checks on the timestamp that was transmitted in
             * the header. In the following implementation the timestamp is
             * valid if it was created after (now-ttl), where ttl is set on
             * server side, not by the client.
             *
             * Note: the method verifyTimestamp(Timestamp) allows custom
             * implementations with other validation algorithms for subclasses.
             */

            // Extract the timestamp action result from the action vector
            actionResult = WSSecurityUtil.fetchActionResult(wsResult, WSConstants.TS);

            if (actionResult != null)
            {
                Timestamp timestamp = actionResult.getTimestamp();

                if (timestamp != null)
                {
                    if (!verifyTimestamp(timestamp, decodeTimeToLive(reqData)))
                    {
                        log.error("WSS4JInHandler: The timestamp could not be validated");
                        throw new XFireFault(
                                "WSS4JInHandler: The timestamp could not be validated",
                                XFireFault.SENDER);
                    }
                }
            }

            /*
             * now check the security actions: do they match, in right order?
             */
            if (!checkReceiverResults(wsResult, actions))
            {
                log.error("WSS4JInHandler: security processing failed (actions mismatch)");
                throw new XFireFault(
                        "WSS4JInHandler: security processing failed (actions mismatch)",
                        XFireFault.SENDER);

            }
            /*
 
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

            }
            catch (Exception e)
            {
                logger.error(e);

                XFireFault fault = XFireFault.createFault(e);
                context.setProperty(DefaultFaultHandler.EXCEPTION, fault);
               
                context.getCurrentPipeline().pause();
               
                context.getCurrentPipeline().handleFault(fault, context);
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

        {
            node = STAXUtils.read(builder, sReader, true).getDocumentElement();
        }
        catch (XMLStreamException e1)
        {
            throw new XFireFault("Could not parse XML stream.", e1, XFireFault.SENDER);
        }

        try
        {
           
            unmarshaller = new Unmarshaller(getTypeClass());
            if (this.mapping != null)
            {
                unmarshaller.setMapping(this.mapping);
            }
            if (log.isDebugEnabled())
            {
                unmarshaller.setDebug(true);
                unmarshaller.setLogWriter(new LogPrintWriter());
            }
        }
        catch (MappingException e)
        {
            String error = "Could not use specified mapping for unmarshalling.";
            log.error(error, e);
            throw new XFireRuntimeException(error, e);
        }

        try
        {
            // Use Castor to unmarshall the DOM Node.
            return unmarshaller.unmarshal((org.w3c.dom.Node) node);
        }
        catch (MarshalException e)
        {
            log.error("Error during unmarshalling process.", e);
            throw new XFireFault(e);
        }
        catch (ValidationException e)
        {
            log.error("Error validating DOM node for unmarshalling.", e);
            throw new XFireFault(e);
        }
    }
View Full Code Here

Examples of org.codehaus.xfire.fault.XFireFault

            }
        }
        catch (IOException e)
        {
            log.error("Could not marshall type.", e);
            throw new XFireFault(e);
        }
        catch (MappingException e)
        {
            log.error("Could not use specified Castor mapping for marshalling.", e);
            throw new XFireFault(e);
        }

        try
        {
            marshaller.marshal(object);
        }
        catch (MarshalException e)
        {
            log.error("Error during marshalling process.", e);
            throw new XFireFault(e);
        }
        catch (ValidationException e)
        {
            log.error("Could not marshall object due to validation error.", e);
            throw new XFireFault(e);
        }
    }
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.