Search in sources :

Example 1 with ParameterEventProducer

use of org.apache.cxf.binding.corba.types.ParameterEventProducer in project cxf by apache.

the class CorbaStreamInInterceptor method handleRequest.

private void handleRequest(Message msg) {
    ORB orb;
    ServiceInfo service;
    CorbaDestination destination;
    if (msg.getDestination() != null) {
        destination = (CorbaDestination) msg.getDestination();
    } 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);
}
Also used : CorbaTypeMap(org.apache.cxf.binding.corba.CorbaTypeMap) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) WrappedParameterSequenceEventProducer(org.apache.cxf.binding.corba.types.WrappedParameterSequenceEventProducer) CorbaMessage(org.apache.cxf.binding.corba.CorbaMessage) QName(javax.xml.namespace.QName) HandlerIterator(org.apache.cxf.binding.corba.types.HandlerIterator) CorbaStreamReader(org.apache.cxf.binding.corba.runtime.CorbaStreamReader) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) Exchange(org.apache.cxf.message.Exchange) ParameterEventProducer(org.apache.cxf.binding.corba.types.ParameterEventProducer) CorbaDestination(org.apache.cxf.binding.corba.CorbaDestination) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) CorbaTypeEventProducer(org.apache.cxf.binding.corba.types.CorbaTypeEventProducer) ServerRequest(org.omg.CORBA.ServerRequest) NVList(org.omg.CORBA.NVList) ORB(org.omg.CORBA.ORB)

Example 2 with ParameterEventProducer

use of org.apache.cxf.binding.corba.types.ParameterEventProducer in project cxf by apache.

the class CorbaStreamInInterceptor method handleReply.

private void handleReply(Message msg) {
    ORB orb;
    ServiceInfo service;
    CorbaDestination destination;
    if (msg.getDestination() != null) {
        destination = (CorbaDestination) msg.getDestination();
    } 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().getEndpoint();
        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();
    BindingOperationInfo bindingOpInfo = exchange.getBindingOperationInfo();
    BindingMessageInfo msgInfo = bindingOpInfo.getOutput();
    boolean wrap = false;
    if (bindingOpInfo.isUnwrappedCapable()) {
        wrap = true;
    }
    if (wrap) {
        // wrapper element around our args
        // REVISIT, bravi, message name same as the element name
        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);
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) WrappedParameterSequenceEventProducer(org.apache.cxf.binding.corba.types.WrappedParameterSequenceEventProducer) CorbaMessage(org.apache.cxf.binding.corba.CorbaMessage) QName(javax.xml.namespace.QName) HandlerIterator(org.apache.cxf.binding.corba.types.HandlerIterator) CorbaStreamReader(org.apache.cxf.binding.corba.runtime.CorbaStreamReader) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) Exchange(org.apache.cxf.message.Exchange) ParameterEventProducer(org.apache.cxf.binding.corba.types.ParameterEventProducer) CorbaDestination(org.apache.cxf.binding.corba.CorbaDestination) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) CorbaTypeEventProducer(org.apache.cxf.binding.corba.types.CorbaTypeEventProducer) ORB(org.omg.CORBA.ORB)

Aggregations

QName (javax.xml.namespace.QName)2 CorbaDestination (org.apache.cxf.binding.corba.CorbaDestination)2 CorbaMessage (org.apache.cxf.binding.corba.CorbaMessage)2 CorbaStreamReader (org.apache.cxf.binding.corba.runtime.CorbaStreamReader)2 CorbaTypeEventProducer (org.apache.cxf.binding.corba.types.CorbaTypeEventProducer)2 HandlerIterator (org.apache.cxf.binding.corba.types.HandlerIterator)2 ParameterEventProducer (org.apache.cxf.binding.corba.types.ParameterEventProducer)2 WrappedParameterSequenceEventProducer (org.apache.cxf.binding.corba.types.WrappedParameterSequenceEventProducer)2 Exchange (org.apache.cxf.message.Exchange)2 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)2 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)2 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)2 ORB (org.omg.CORBA.ORB)2 CorbaTypeMap (org.apache.cxf.binding.corba.CorbaTypeMap)1 OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)1 Endpoint (org.apache.cxf.endpoint.Endpoint)1 BindingInfo (org.apache.cxf.service.model.BindingInfo)1 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)1 NVList (org.omg.CORBA.NVList)1 ServerRequest (org.omg.CORBA.ServerRequest)1