FileDocCategorySizeDatePackage
ProviderInOut.javaAPI DocGlassfish v2 API8163Fri May 04 22:30:28 BST 2007com.sun.enterprise.jbi.serviceengine.comm

ProviderInOut

public class ProviderInOut extends MessageExchangeTransportImpl
This class handles sending message to & receiving message from NMR when 1) Role of the component is Provider. 2) Message exchange pattern is In-Out.
author
bhavanishankar@dev.java.net

Fields Summary
private javax.jbi.messaging.InOut
me
Constructors Summary
public ProviderInOut(javax.jbi.messaging.InOut me)

        super(me);
        this.me = me;
    
Methods Summary
public UnWrappedMessagereceive(com.sun.enterprise.jbi.serviceengine.util.soap.EndpointMetaData emd)

        NormalizedMessage normalizedMessage = receiveNormalized();
        UnWrappedMessage unwrappedMessage = null;
        if(normalizedMessage != null) {
            try {
                
                String operationName = me.getOperation().getLocalPart();
                
                unwrappedMessage = new UnWrappedMessage();
                unwrappedMessage.setNormalizedMessage(normalizedMessage);
                
                if(normalizedMessage instanceof Fault) {
                    unwrappedMessage.unwrapFault();
                } else {
                    unwrappedMessage.setWSDLMessageType(
                            new QName(
                            emd.getInputMessage(operationName).getQName().getNamespaceURI(),
                            operationName));
                    
                    unwrappedMessage.setWSDLBindingStyle(
                            emd.getBindingStyle(operationName));
                    
                    unwrappedMessage.setWSDLOrderedParts(
                            emd.getInputMessage(operationName).getOrderedParts(null));
                    
                    unwrappedMessage.setWSDLPartBindings(
                            emd.getInputPartBindings(operationName));
                    
                    unwrappedMessage.unwrap();
                }
            } catch(Exception ex) {
                logger.log(Level.SEVERE, ex.getMessage(), ex);
                // TODO : Should we send error/fault to client???
            }
        }
        return unwrappedMessage;
    
public javax.jbi.messaging.NormalizedMessagereceiveNormalized()

        msg = me.getInMessage();
        preReceive();
        return msg;
    
public voidsend(javax.jbi.messaging.NormalizedMessage response)

        if(response instanceof Fault) {
            me.setFault((Fault)response);
        } else {
            me.setOutMessage(response);
        }
        this.msg = response;
        send();
    
public voidsend(com.sun.xml.ws.api.message.Message message, com.sun.enterprise.jbi.serviceengine.util.soap.EndpointMetaData emd)

        String operationName = me.getOperation().getLocalPart();
        WrappedMessage wrappedMessage = new WrappedMessage();
        wrappedMessage.setAbstractMessage(message);
        
        if(message.isFault()) {
            wrappedMessage.wrapFault(operationName, emd);
        } else {
            wrappedMessage.setWSDLBindingStyle(emd.getBindingStyle(operationName));
            wrappedMessage.setWSDLMessageType(emd.getOutputMessage(operationName).getQName());
            wrappedMessage.setWSDLMessageName(emd.getOperationOutputName(operationName));
            wrappedMessage.setWSDLOrderedParts(emd.getOutputMessage(operationName).getOrderedParts(null));
            wrappedMessage.setWSDLPartBindings(emd.getOutputPartBindings(operationName));
            wrappedMessage.wrap();
        }
        NormalizedMessage normalizedMessage = wrappedMessage.isFault() ?
            me.createFault() : me.createMessage();
        normalizedMessage.setContent(wrappedMessage.readPayloadAsSource());
        send(normalizedMessage);