Package org.apache.cxf.binding.corba

Examples of org.apache.cxf.binding.corba.CorbaMessage


    public CorbaStreamFaultOutInterceptor() {
        super(Phase.MARSHAL);
    }

    public void handleMessage(Message msg) {
        CorbaMessage message = (CorbaMessage) msg;
        Exchange exchange = message.getExchange();
        CorbaDestination destination;
        Fault faultEx = null;
        if (message.getDestination() != null) {
            destination = (CorbaDestination)message.getDestination();
        } else {
            destination = (CorbaDestination)exchange.getDestination();
        }

        orb = (ORB) message.get(CorbaConstants.ORB);
        if (orb == null) {
            orb = (ORB) exchange.get(ORB.class);
        }
       
        DataWriter<XMLStreamWriter> writer = getDataWriter(message);

        Throwable ex = message.getContent(Exception.class);
        // JCGS. If the cause is not available I can only continue if the exception
        //       is a Fault instance and contains a detail object.
        if (ex.getCause() == null) {
            if ((ex instanceof Fault) && (((Fault)ex).getDetail() != null)) {
                faultEx = (Fault) ex;
            } else {
                throw new CorbaBindingException(ex);
            }
        } else {
            ex = ex.getCause();
        }
      
        if (ex instanceof InvocationTargetException) {
            ex = ex.getCause();
        }

        if (ex instanceof SystemException) {
            setSystemException(message, ex, destination);
            return;
        }
       
        String exClassName = null;
        if (faultEx == null) {
            //REVISIT, we should not have to depend on WebFault annotation
            //Try changing the fault name to the proper mangled java exception classname.
            WebFault fault = ex.getClass().getAnnotation(WebFault.class);
            if (fault == null) {
                throw new CorbaBindingException(ex);
            }
            exClassName = fault.name();
        else {
            //JCGS: exClassName to be set to the exception name
            Element faultElement = (Element) faultEx.getDetail().getFirstChild();
            exClassName = faultElement.getLocalName();
        }

        // Get information about the operation being invoked from the WSDL
        // definition.
        // We need this to marshal data correctly

        BindingInfo bInfo = destination.getBindingInfo();    
       
        String opName = message.getExchange().get(String.class);
               
        Iterator iter = bInfo.getOperations().iterator();

        BindingOperationInfo bopInfo = null;
        OperationType opType = null;          
View Full Code Here


        super(Phase.UNMARSHAL);
        addAfter(ClientFaultConverter.class.getName());
    }   

    public void handleMessage(Message msg) {
        CorbaMessage message = (CorbaMessage)msg;
       
       
        try {
           
            SystemException sysEx = message.getSystemException();
            if (sysEx != null) {
                // TODO: Do we need anything else to handle system exceptions here...i.e. do
                // we want to add a wrapper around this so that we can add some more information?
                message.setContent(Exception.class, sysEx);
                return;
            }

            CorbaStreamable exStreamable = message.getStreamableException();
            if (exStreamable != null) {
                DataReader<XMLStreamReader> reader = getDataReader(message);

                BindingOperationInfo bopInfo = message.getExchange().get(BindingOperationInfo.class);
                OperationInfo opInfo = bopInfo.getOperationInfo();
               
                ServiceInfo service = message.getExchange().get(ServiceInfo.class);
               
                org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) message.get(CorbaConstants.ORB);
                if (orb == null) {
                    orb = (org.omg.CORBA.ORB) message.getExchange().get(org.omg.CORBA.ORB.class);
                }
                QName elName = new QName("", exStreamable.getName());
                FaultInfo fault = getFaultInfo(opInfo, elName);
               
                CorbaTypeEventProducer faultEventProducer =
                    CorbaHandlerUtils.getTypeEventProducer(exStreamable.getObject(),
                                                           service,
                                                           orb);
                CorbaStreamReader streamReader = new CorbaStreamReader(faultEventProducer);

                Object e = reader.read(fault.getMessageParts().get(0), streamReader);
                if (!(e instanceof Exception)) {
                    Class<?> exClass = fault.getProperty(Class.class.getName(), Class.class);
                    if (exClass != null) {
                        Class<?> beanClass = e.getClass();
                        Constructor<?> constructor =
                            exClass.getConstructor(new Class[]{String.class, beanClass});
                       
                        String repId = (message.getStreamableException()._type().id() != null)
                            ? message.getStreamableException()._type().id()
                                : "";
                        e = constructor.newInstance(new Object[]{repId, e});
                    } else {
                        // Get the Fault                        
                        Fault faultEx = (Fault) message.getContent(Exception.class);
                        if (e instanceof Document) {
                            createFaultDetail((Document)e, fault, faultEx);
                        }
                        e = faultEx;
                    }
                }
                message.setContent(Exception.class, (Exception) e);
            }
        } catch (java.lang.Exception ex) {
            LOG.log(Level.SEVERE, "CORBA unmarshalFault exception", ex);
            throw new CorbaBindingException("CORBA unmarshalFault exception", ex);
        }
View Full Code Here

        } else {
            destination = (CorbaDestination)msg.getExchange().getDestination();
        }
        service = destination.getBindingInfo().getService();

        CorbaMessage message = (CorbaMessage)msg;
        if (message.getStreamableException() != null || message.getSystemException() != null) {
            Endpoint ep = message.getExchange().get(Endpoint.class);
            message.getInterceptorChain().abort();
            if (ep.getInFaultObserver() != null) {
                ep.getInFaultObserver().onMessage(message);
                return;
            }
        }

        CorbaMessage outMessage = (CorbaMessage)message.getExchange().getOutMessage();
        orb = (ORB)message.getExchange().get(ORB.class);
        HandlerIterator paramIterator = new HandlerIterator(outMessage, false);

        CorbaTypeEventProducer eventProducer = null;
        Exchange exchange = message.getExchange();
View Full Code Here

        } else {
            destination = (CorbaDestination)msg.getExchange().getDestination();
        }
        service = destination.getBindingInfo().getService();

        CorbaMessage message = (CorbaMessage) msg;

        Exchange exchange = message.getExchange();

        CorbaTypeMap typeMap = message.getCorbaTypeMap();

        BindingInfo bInfo = destination.getBindingInfo();             
        InterfaceInfo info = bInfo.getInterface();
        String opName = exchange.get(String.class);
        Iterator i = bInfo.getOperations().iterator();
        OperationType opType = null;
        BindingOperationInfo bopInfo = null;
        QName opQName = null;
        while (i.hasNext()) {
            bopInfo = (BindingOperationInfo)i.next();
            if (bopInfo.getName().getLocalPart().equals(opName)) {
                opType = bopInfo.getExtensor(OperationType.class);
                opQName = bopInfo.getName();
                break;
            }
        }

        if (opType == null) {
            throw new RuntimeException("Couldn't find the binding operation for " + opName);
        }

        orb = (ORB)exchange.get(ORB.class);

        ServerRequest request = exchange.get(ServerRequest.class);
        NVList list = prepareArguments(message, info, opType,
                                       opQName, typeMap,
                                       destination, service);
        request.arguments(list);
        message.setList(list);

        HandlerIterator paramIterator = new HandlerIterator(message, true);

        CorbaTypeEventProducer eventProducer = null;
        BindingMessageInfo msgInfo = bopInfo.getInput();
        boolean wrap = false;
        if (bopInfo.isUnwrappedCapable()) {
            wrap = true;
        }

        if (wrap) {
            // wrapper element around our args
            QName wrapperElementQName = msgInfo.getMessageInfo().getName();
            eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName,
                                                                      paramIterator,
                                                                      service,
                                                                      orb);
        } else {
            eventProducer = new ParameterEventProducer(paramIterator,
                                                       service,
                                                       orb);
        }
        CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
        message.setContent(XMLStreamReader.class, reader);
    }
View Full Code Here

    public CorbaStreamFaultOutInterceptor() {
        super(Phase.MARSHAL);
    }

    public void handleMessage(Message msg) {
        CorbaMessage message = (CorbaMessage) msg;
        Exchange exchange = message.getExchange();
        CorbaDestination destination;
        Fault faultEx = null;
        if (message.getDestination() != null) {
            destination = (CorbaDestination)message.getDestination();
        } else {
            destination = (CorbaDestination)exchange.getDestination();
        }

        orb = (ORB) message.get(CorbaConstants.ORB);
        if (orb == null) {
            orb = exchange.get(ORB.class);
        }
       
        DataWriter<XMLStreamWriter> writer = getDataWriter(message);

        Throwable ex = message.getContent(Exception.class);
        // JCGS. If the cause is not available I can only continue if the exception
        //       is a Fault instance and contains a detail object.
        if (ex.getCause() == null) {
            if ((ex instanceof Fault) && (((Fault)ex).getDetail() != null)) {
                faultEx = (Fault) ex;
            } else {
                throw new CorbaBindingException(ex);
            }
        } else {
            ex = ex.getCause();
        }
      
        if (ex instanceof InvocationTargetException) {
            ex = ex.getCause();
        }

        if (ex instanceof SystemException) {
            setSystemException(message, ex, destination);
            return;
        }
       
        String exClassName = null;
        if (faultEx == null) {
            //REVISIT, we should not have to depend on WebFault annotation
            //Try changing the fault name to the proper mangled java exception classname.
            WebFault fault = ex.getClass().getAnnotation(WebFault.class);
            if (fault == null) {
                throw new CorbaBindingException(ex);
            }
            exClassName = fault.name();
        else {
            //JCGS: exClassName to be set to the exception name
            Element faultElement = (Element) faultEx.getDetail().getFirstChild();
            exClassName = faultElement.getLocalName();
        }

        // Get information about the operation being invoked from the WSDL
        // definition.
        // We need this to marshal data correctly

        BindingInfo bInfo = destination.getBindingInfo();    
       
        String opName = message.getExchange().get(String.class);
               
        Iterator<BindingOperationInfo> iter = bInfo.getOperations().iterator();

        BindingOperationInfo bopInfo = null;
        OperationType opType = null;          
View Full Code Here

        } else {
            destination = (CorbaDestination)msg.getExchange().getDestination();
        }
        service = destination.getBindingInfo().getService();

        CorbaMessage message = (CorbaMessage)msg;
        if (message.getStreamableException() != null || message.getSystemException() != null) {
            message.setContent(Exception.class,
                               message.getExchange().getOutMessage().getContent(Exception.class));

            Endpoint ep = message.getExchange().get(Endpoint.class);
            message.getInterceptorChain().abort();
            if (ep.getInFaultObserver() != null) {
                ep.getInFaultObserver().onMessage(message);
                return;
            }
        }

        CorbaMessage outMessage = (CorbaMessage)message.getExchange().getOutMessage();
        orb = message.getExchange().get(ORB.class);
        HandlerIterator paramIterator = new HandlerIterator(outMessage, false);

        CorbaTypeEventProducer eventProducer = null;
        Exchange exchange = message.getExchange();
View Full Code Here

        } else {
            destination = (CorbaDestination)msg.getExchange().getDestination();
        }
        service = destination.getBindingInfo().getService();

        CorbaMessage message = (CorbaMessage) msg;

        Exchange exchange = message.getExchange();

        CorbaTypeMap typeMap = message.getCorbaTypeMap();

        BindingInfo bInfo = destination.getBindingInfo();             
        InterfaceInfo info = bInfo.getInterface();
        String opName = exchange.get(String.class);
        Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
        OperationType opType = null;
        BindingOperationInfo bopInfo = null;
        QName opQName = null;
        while (i.hasNext()) {
            bopInfo = i.next();
            if (bopInfo.getName().getLocalPart().equals(opName)) {
                opType = bopInfo.getExtensor(OperationType.class);
                opQName = bopInfo.getName();
                break;
            }
        }

        if (opType == null) {
            throw new RuntimeException("Couldn't find the binding operation for " + opName);
        }

        orb = exchange.get(ORB.class);

        ServerRequest request = exchange.get(ServerRequest.class);
        NVList list = prepareArguments(message, info, opType,
                                       opQName, typeMap,
                                       destination, service);
        request.arguments(list);
        message.setList(list);

        HandlerIterator paramIterator = new HandlerIterator(message, true);

        CorbaTypeEventProducer eventProducer = null;
        BindingMessageInfo msgInfo = bopInfo.getInput();
        boolean wrap = false;
        if (bopInfo.isUnwrappedCapable()) {
            wrap = true;
        }

        if (wrap) {
            // wrapper element around our args
            QName wrapperElementQName = msgInfo.getMessageInfo().getName();
            eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName,
                                                                      paramIterator,
                                                                      service,
                                                                      orb);
        } else {
            eventProducer = new ParameterEventProducer(paramIterator,
                                                       service,
                                                       orb);
        }
        CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
        message.setContent(XMLStreamReader.class, reader);
    }
View Full Code Here

    public CorbaStreamFaultOutInterceptor() {
        super(Phase.MARSHAL);
    }

    public void handleMessage(Message msg) {
        CorbaMessage message = (CorbaMessage) msg;
        Exchange exchange = message.getExchange();
        CorbaDestination destination;
        Fault faultEx = null;
        if (message.getDestination() != null) {
            destination = (CorbaDestination)message.getDestination();
        } else {
            destination = (CorbaDestination)exchange.getDestination();
        }

        orb = (ORB) message.get(CorbaConstants.ORB);
        if (orb == null) {
            orb = (ORB) exchange.get(ORB.class);
        }
       
        DataWriter<XMLStreamWriter> writer = getDataWriter(message);

        Throwable ex = message.getContent(Exception.class);
        // JCGS. If the cause is not available I can only continue if the exception
        //       is a Fault instance and contains a detail object.
        if (ex.getCause() == null) {
            if ((ex instanceof Fault) && (((Fault)ex).getDetail() != null)) {
                faultEx = (Fault) ex;
            } else {
                throw new CorbaBindingException(ex);
            }
        } else {
            ex = ex.getCause();
        }
      
        if (ex instanceof InvocationTargetException) {
            ex = ex.getCause();
        }

        if (ex instanceof SystemException) {
            setSystemException(message, ex, destination);
            return;
        }
       
        String exClassName = null;
        if (faultEx == null) {
            //REVISIT, we should not have to depend on WebFault annotation
            //Try changing the fault name to the proper mangled java exception classname.
            WebFault fault = ex.getClass().getAnnotation(WebFault.class);
            if (fault == null) {
                throw new CorbaBindingException(ex);
            }
            exClassName = fault.name();
        else {
            //JCGS: exClassName to be set to the exception name
            Element faultElement = (Element) faultEx.getDetail().getFirstChild();
            exClassName = faultElement.getLocalName();
        }

        // Get information about the operation being invoked from the WSDL
        // definition.
        // We need this to marshal data correctly

        BindingInfo bInfo = destination.getBindingInfo();    
       
        String opName = message.getExchange().get(String.class);
               
        Iterator<BindingOperationInfo> iter = bInfo.getOperations().iterator();

        BindingOperationInfo bopInfo = null;
        OperationType opType = null;          
View Full Code Here

        } else {
            destination = (CorbaDestination)msg.getExchange().getDestination();
        }
        service = destination.getBindingInfo().getService();

        CorbaMessage message = (CorbaMessage)msg;
        if (message.getStreamableException() != null || message.getSystemException() != null) {
            message.setContent(Exception.class,
                               message.getExchange().getOutMessage().getContent(Exception.class));

            Endpoint ep = message.getExchange().get(Endpoint.class);
            message.getInterceptorChain().abort();
            if (ep.getInFaultObserver() != null) {
                ep.getInFaultObserver().onMessage(message);
                return;
            }
        }

        CorbaMessage outMessage = (CorbaMessage)message.getExchange().getOutMessage();
        orb = (ORB)message.getExchange().get(ORB.class);
        HandlerIterator paramIterator = new HandlerIterator(outMessage, false);

        CorbaTypeEventProducer eventProducer = null;
        Exchange exchange = message.getExchange();
View Full Code Here

        } else {
            destination = (CorbaDestination)msg.getExchange().getDestination();
        }
        service = destination.getBindingInfo().getService();

        CorbaMessage message = (CorbaMessage) msg;

        Exchange exchange = message.getExchange();

        CorbaTypeMap typeMap = message.getCorbaTypeMap();

        BindingInfo bInfo = destination.getBindingInfo();             
        InterfaceInfo info = bInfo.getInterface();
        String opName = exchange.get(String.class);
        Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
        OperationType opType = null;
        BindingOperationInfo bopInfo = null;
        QName opQName = null;
        while (i.hasNext()) {
            bopInfo = i.next();
            if (bopInfo.getName().getLocalPart().equals(opName)) {
                opType = bopInfo.getExtensor(OperationType.class);
                opQName = bopInfo.getName();
                break;
            }
        }

        if (opType == null) {
            throw new RuntimeException("Couldn't find the binding operation for " + opName);
        }

        orb = (ORB)exchange.get(ORB.class);

        ServerRequest request = exchange.get(ServerRequest.class);
        NVList list = prepareArguments(message, info, opType,
                                       opQName, typeMap,
                                       destination, service);
        request.arguments(list);
        message.setList(list);

        HandlerIterator paramIterator = new HandlerIterator(message, true);

        CorbaTypeEventProducer eventProducer = null;
        BindingMessageInfo msgInfo = bopInfo.getInput();
        boolean wrap = false;
        if (bopInfo.isUnwrappedCapable()) {
            wrap = true;
        }

        if (wrap) {
            // wrapper element around our args
            QName wrapperElementQName = msgInfo.getMessageInfo().getName();
            eventProducer = new WrappedParameterSequenceEventProducer(wrapperElementQName,
                                                                      paramIterator,
                                                                      service,
                                                                      orb);
        } else {
            eventProducer = new ParameterEventProducer(paramIterator,
                                                       service,
                                                       orb);
        }
        CorbaStreamReader reader = new CorbaStreamReader(eventProducer);
        message.setContent(XMLStreamReader.class, reader);
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.binding.corba.CorbaMessage

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.