1 16 package org.apache.axis2.receivers; 17 18 import org.apache.axis2.addressing.AddressingConstants; 19 import org.apache.axis2.addressing.MessageInformationHeadersCollection; 20 import org.apache.axis2.addressing.miheaders.RelatesTo; 21 import org.apache.axis2.context.MessageContext; 22 import org.apache.axis2.engine.AxisEngine; 23 import org.apache.axis2.engine.AxisFault; 24 import org.apache.axis2.transport.http.HTTPConstants; 25 26 30 public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver { 31 public abstract void invokeBusinessLogic( 32 MessageContext inMessage, 33 MessageContext outMessage) 34 throws AxisFault; 35 36 public final void recieve(MessageContext messgeCtx) throws AxisFault { 37 MessageContext newmsgCtx = 38 new MessageContext(messgeCtx.getSystemContext(), 39 messgeCtx.getSessionContext(), 40 messgeCtx.getTransportIn(), 41 messgeCtx.getTransportOut()); 42 43 newmsgCtx.setMessageInformationHeaders(new MessageInformationHeadersCollection()); 44 MessageInformationHeadersCollection oldMessageInfoHeaders = 45 messgeCtx.getMessageInformationHeaders(); 46 MessageInformationHeadersCollection messageInformationHeaders = 47 new MessageInformationHeadersCollection(); 48 messageInformationHeaders.setTo(oldMessageInfoHeaders.getReplyTo()); 49 messageInformationHeaders.setFaultTo(oldMessageInfoHeaders.getFaultTo()); 50 messageInformationHeaders.setFrom(oldMessageInfoHeaders.getTo()); 51 messageInformationHeaders.setRelatesTo( 52 new RelatesTo( 53 oldMessageInfoHeaders.getMessageId(), 54 AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE)); 55 newmsgCtx.setMessageInformationHeaders(messageInformationHeaders); 56 newmsgCtx.setOperationContext(messgeCtx.getOperationContext()); 57 newmsgCtx.setServiceContext(messgeCtx.getServiceContext()); 58 newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,messgeCtx.getProperty(MessageContext.TRANSPORT_OUT)); 59 newmsgCtx.setProperty(HTTPConstants.HTTPOutTransportInfo,messgeCtx.getProperty(HTTPConstants.HTTPOutTransportInfo)); 60 newmsgCtx.setDoingREST(messgeCtx.isDoingREST()); 61 newmsgCtx.setDoingMTOM(messgeCtx.isDoingMTOM()); 62 63 invokeBusinessLogic(messgeCtx,newmsgCtx); 64 65 AxisEngine engine = 66 new AxisEngine( 67 messgeCtx.getOperationContext().getServiceContext().getEngineContext()); 68 engine.send(newmsgCtx); 69 } 70 } 71 | Popular Tags |