Search in sources :

Example 1 with HTTPClient4TransportSender

use of org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender in project axis-axis2-java-core by apache.

the class OptionsSaveTest method testSaveAndRestore.

public void testSaveAndRestore() throws Exception {
    File theFile = null;
    String theFilename = null;
    boolean saved = false;
    boolean restored = false;
    boolean done = false;
    boolean comparesOk = false;
    AxisConfiguration axisConfiguration = new AxisConfiguration();
    ConfigurationContext configurationContext = new ConfigurationContext(axisConfiguration);
    log.debug("OptionsSaveTest:testSaveAndRestore():  BEGIN ---------------");
    // ---------------------------------------------------------
    // setup an options object to use
    // ---------------------------------------------------------
    Options options = new Options();
    options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
    options.setExceptionToBeThrownOnSOAPFault(true);
    options.setTimeOutInMilliSeconds(5000L);
    options.setUseSeparateListener(false);
    options.setAction("SoapAction");
    options.setFaultTo(new EndpointReference("http://ws.apache.org/axis2/faultTo"));
    options.setFrom(new EndpointReference("http://ws.apache.org/axis2/from"));
    options.setTo(new EndpointReference("http://ws.apache.org/axis2/to"));
    options.setReplyTo(new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL));
    TransportOutDescription transportOut = new TransportOutDescription("null");
    TransportOutDescription transportOut2 = new TransportOutDescription("happy");
    TransportOutDescription transportOut3 = new TransportOutDescription("golucky");
    transportOut.setSender(new HTTPClient4TransportSender());
    transportOut2.setSender(new HTTPClient4TransportSender());
    transportOut3.setSender(new HTTPClient4TransportSender());
    options.setTransportOut(transportOut);
    axisConfiguration.addTransportOut(transportOut3);
    axisConfiguration.addTransportOut(transportOut2);
    axisConfiguration.addTransportOut(transportOut);
    TransportInDescription transportIn = new TransportInDescription("null");
    TransportInDescription transportIn2 = new TransportInDescription("always");
    TransportInDescription transportIn3 = new TransportInDescription("thebest");
    transportIn.setReceiver(new SimpleHTTPServer());
    transportIn2.setReceiver(new SimpleHTTPServer());
    transportIn3.setReceiver(new SimpleHTTPServer());
    options.setTransportIn(transportIn);
    axisConfiguration.addTransportIn(transportIn2);
    axisConfiguration.addTransportIn(transportIn);
    axisConfiguration.addTransportIn(transportIn3);
    options.setMessageId("msgId012345");
    options.setProperty("key01", "value01");
    options.setProperty("key02", "value02");
    options.setProperty("key03", "value03");
    options.setProperty("key04", "value04");
    options.setProperty("key05", "value05");
    options.setProperty("key06", "value06");
    options.setProperty("key07", "value07");
    options.setProperty("key08", "value08");
    options.setProperty("key09", "value09");
    options.setProperty("key10", "value10");
    // ---------------------------------------------------------
    try {
        theFile = File.createTempFile("optionsSave", null);
        theFilename = theFile.getName();
        log.debug("OptionsSaveTest:testSaveAndRestore(): temp file = [" + theFilename + "]");
    } catch (Exception ex) {
        log.debug("OptionsSaveTest:testSaveAndRestore(): error creating temp file = [" + ex.getMessage() + "]");
        theFile = null;
    }
    if (theFile != null) {
        // ---------------------------------------------------------
        try {
            // setup an output stream to a physical file
            FileOutputStream outStream = new FileOutputStream(theFile);
            // attach a stream capable of writing objects to the
            // stream connected to the file
            ObjectOutputStream outObjStream = new ObjectOutputStream(outStream);
            // try to save the message context
            log.debug("OptionsSaveTest:testSaveAndRestore(): saving .....");
            saved = false;
            outObjStream.writeObject(options);
            // close out the streams
            outObjStream.flush();
            outObjStream.close();
            outStream.flush();
            outStream.close();
            saved = true;
            log.debug("OptionsSaveTest:testSaveAndRestore(): ....save operation completed.....");
            long filesize = theFile.length();
            log.debug("OptionsSaveTest:testSaveAndRestore(): file size after save [" + filesize + "]   temp file = [" + theFilename + "]");
        } catch (Exception ex2) {
            if (saved != true) {
                log.debug("OptionsSaveTest:testSaveAndRestore(): error during save [" + ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
                ex2.printStackTrace();
            } else {
                log.debug("OptionsSaveTest:testSaveAndRestore(): error during restore [" + ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
                ex2.printStackTrace();
            }
        }
        assertTrue(saved);
        // ---------------------------------------------------------
        try {
            // setup an input stream to the file
            FileInputStream inStream = new FileInputStream(theFile);
            // attach a stream capable of reading objects from the
            // stream connected to the file
            ObjectInputStream inObjStream = new ObjectInputStream(inStream);
            // try to restore the options
            log.debug("OptionsSaveTest:testSaveAndRestore(): restoring .....");
            restored = false;
            Options options_restored = (Options) inObjStream.readObject();
            inObjStream.close();
            inStream.close();
            options_restored.activate(configurationContext);
            restored = true;
            log.debug("OptionsSaveTest:testSaveAndRestore(): ....restored operation completed.....");
            comparesOk = options_restored.isEquivalent(options);
            log.debug("OptionsSaveTest:testSaveAndRestore():   Options equivalency [" + comparesOk + "]");
        } catch (Exception ex2) {
            log.debug("OptionsSaveTest:testSaveAndRestore(): error during restore [" + ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
            ex2.printStackTrace();
        }
        assertTrue(restored);
        assertTrue(comparesOk);
        // if the save/restore of the object succeeded,
        // then don't keep the temporary file around
        boolean removeTmpFile = saved && restored && comparesOk;
        if (removeTmpFile) {
            try {
                theFile.delete();
            } catch (Exception e) {
            // just absorb it
            }
        }
        // indicate that the temp file was created ok
        done = true;
    }
    // this is false when there are problems with the temporary file
    assertTrue(done);
    log.debug("OptionsSaveTest:testSaveAndRestore():  END ---------------");
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) Options(org.apache.axis2.client.Options) TransportInDescription(org.apache.axis2.description.TransportInDescription) ObjectOutputStream(java.io.ObjectOutputStream) SimpleHTTPServer(org.apache.axis2.transport.http.SimpleHTTPServer) FileInputStream(java.io.FileInputStream) EndpointReference(org.apache.axis2.addressing.EndpointReference) HTTPClient4TransportSender(org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender) FileOutputStream(java.io.FileOutputStream) File(java.io.File) TransportOutDescription(org.apache.axis2.description.TransportOutDescription) ObjectInputStream(java.io.ObjectInputStream)

Example 2 with HTTPClient4TransportSender

use of org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender in project axis-axis2-java-core by apache.

the class MessageContextSaveATest method prepare.

// 
// prepare the object hierarchy for testing
// 
private void prepare() throws Exception {
    // -----------------------------------------------------------------
    AxisConfiguration axisConfiguration = new AxisConfiguration();
    configurationContext = new ConfigurationContext(axisConfiguration);
    configurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/ns/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
    configurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/ns/wsdl/in-out", new RawXMLINOutMessageReceiver());
    DispatchPhase dispatchPhase = new DispatchPhase();
    dispatchPhase.setName("Dispatch");
    AddressingBasedDispatcher abd = new AddressingBasedDispatcher();
    abd.initDispatcher();
    RequestURIBasedDispatcher rud = new RequestURIBasedDispatcher();
    rud.initDispatcher();
    SOAPActionBasedDispatcher sabd = new SOAPActionBasedDispatcher();
    sabd.initDispatcher();
    SOAPMessageBodyBasedDispatcher smbd = new SOAPMessageBodyBasedDispatcher();
    smbd.initDispatcher();
    dispatchPhase.addHandler(abd);
    dispatchPhase.addHandler(rud);
    dispatchPhase.addHandler(sabd);
    dispatchPhase.addHandler(smbd);
    configurationContext.getAxisConfiguration().getInFlowPhases().add(dispatchPhase);
    // -----------------------------------------------------------------
    axisServiceGroup = new AxisServiceGroup(axisConfiguration);
    axisServiceGroup.setServiceGroupName("ServiceGroupTest");
    axisService = new AxisService(serviceName.getLocalPart());
    axisServiceGroup.addService(axisService);
    axisOperation = new InOutAxisOperation(operationName);
    axisOperation.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisService.addOperation(axisOperation);
    axisService.mapActionToOperation(operationName.getLocalPart(), axisOperation);
    configurationContext.getAxisConfiguration().addService(axisService);
    // -----------------------------------------------------------------
    serviceGroupContext = configurationContext.createServiceGroupContext(axisService.getAxisServiceGroup());
    serviceGroupContext.setId("ServiceGroupContextTest");
    ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);
    operationContext = serviceContext.createOperationContext(operationName);
    // -----------------------------------------------------------------
    TransportOutDescription transportOut = new TransportOutDescription("null");
    TransportOutDescription transportOut2 = new TransportOutDescription("happy");
    TransportOutDescription transportOut3 = new TransportOutDescription("golucky");
    transportOut.setSender(new HTTPClient4TransportSender());
    transportOut2.setSender(new HTTPClient4TransportSender());
    transportOut3.setSender(new HTTPClient4TransportSender());
    axisConfiguration.addTransportOut(transportOut3);
    axisConfiguration.addTransportOut(transportOut2);
    axisConfiguration.addTransportOut(transportOut);
    TransportInDescription transportIn = new TransportInDescription("null");
    TransportInDescription transportIn2 = new TransportInDescription("always");
    TransportInDescription transportIn3 = new TransportInDescription("thebest");
    transportIn.setReceiver(new SimpleHTTPServer());
    transportIn2.setReceiver(new SimpleHTTPServer());
    transportIn3.setReceiver(new SimpleHTTPServer());
    axisConfiguration.addTransportIn(transportIn2);
    axisConfiguration.addTransportIn(transportIn);
    axisConfiguration.addTransportIn(transportIn3);
    // -----------------------------------------------------------------
    mc = configurationContext.createMessageContext();
    mc.setTransportIn(transportIn);
    mc.setTransportOut(transportOut);
    mc.setServerSide(true);
    // mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);
    SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
    mc.setEnvelope(omFac.getDefaultEnvelope());
    phase1 = new Phase("beginPhase1");
    phase1.addHandler(new TempHandler(1));
    phase1.addHandler(new TempHandler(2));
    phase1.addHandler(new TempHandler(3));
    phase1.addHandler(new TempHandler(4));
    phase1.addHandler(new TempHandler(5));
    phase1.addHandler(new TempHandler(6));
    phase1.addHandler(new TempHandler(7));
    phase1.addHandler(new TempHandler(8));
    phase1.addHandler(new TempHandler(9));
    phase2 = new Phase("middlePhase2");
    phase2.addHandler(new TempHandler(10));
    phase2.addHandler(new TempHandler(11));
    phase2.addHandler(new TempHandler(12));
    phase2.addHandler(new TempHandler(13));
    phase2.addHandler(new TempHandler(14));
    phase2.addHandler(new TempHandler(15, true));
    phase2.addHandler(new TempHandler(16));
    phase2.addHandler(new TempHandler(17));
    phase2.addHandler(new TempHandler(18));
    phase3 = new Phase("lastPhase3");
    phase3.addHandler(new TempHandler(19));
    phase3.addHandler(new TempHandler(20));
    phase3.addHandler(new TempHandler(21));
    phase3.addHandler(new TempHandler(22));
    phase3.addHandler(new TempHandler(23));
    phase3.addHandler(new TempHandler(24));
    phase3.addHandler(new TempHandler(25));
    phase3.addHandler(new TempHandler(26));
    phase3.addHandler(new TempHandler(27));
    phase4 = new Phase("extraPhase1");
    phase4.addHandler(new TempHandler(28));
    phase4.addHandler(new TempHandler(29));
    phase5 = new Phase("extraPhase2");
    phase5.addHandler(new TempHandler(30));
    phase6 = new Phase("extraPhase3");
    phase6.addHandler(new TempHandler(31, true));
    phase6.addHandler(new TempHandler(32));
    phase7 = new Phase("extraPhase4");
    phase7.addHandler(new TempHandler(33));
    phase7.addHandler(new TempHandler(34));
    phase7.addHandler(new TempHandler(35));
    axisOperation.getRemainingPhasesInFlow().add(phase1);
    axisOperation.getRemainingPhasesInFlow().add(phase2);
    axisOperation.getRemainingPhasesInFlow().add(phase3);
    axisOperation.getRemainingPhasesInFlow().add(phase4);
    axisOperation.getRemainingPhasesInFlow().add(phase5);
    axisOperation.getRemainingPhasesInFlow().add(phase6);
    axisOperation.getRemainingPhasesInFlow().add(phase7);
    ArrayList phases = new ArrayList();
    phases.add(phase1);
    phases.add(phase2);
    phases.add(phase3);
    phases.add(phase4);
    phases.add(phase5);
    phases.add(phase6);
    phases.add(phase7);
    axisConfiguration.setInPhasesUptoAndIncludingPostDispatch(phases);
    mc.setWSAAction(operationName.getLocalPart());
    mc.setSoapAction(operationName.getLocalPart());
    // System.out.flush();
    mc.setMessageID(UIDGenerator.generateURNString());
    // operationContext.addMessageContext(mc);  gets done via the register
    axisOperation.registerOperationContext(mc, operationContext);
    mc.setOperationContext(operationContext);
    mc.setServiceContext(serviceContext);
    mc.setTo(new EndpointReference("axis2/services/NullService"));
    mc.setWSAAction("DummyOp");
    axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
    mc.setAxisMessage(axisMessage);
    // -----------------------------------------------------------------
    executedHandlers = new ArrayList();
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) RequestURIBasedDispatcher(org.apache.axis2.dispatchers.RequestURIBasedDispatcher) SOAPActionBasedDispatcher(org.apache.axis2.dispatchers.SOAPActionBasedDispatcher) ServiceContext(org.apache.axis2.context.ServiceContext) AxisService(org.apache.axis2.description.AxisService) ArrayList(java.util.ArrayList) TransportInDescription(org.apache.axis2.description.TransportInDescription) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) SimpleHTTPServer(org.apache.axis2.transport.http.SimpleHTTPServer) AxisServiceGroup(org.apache.axis2.description.AxisServiceGroup) SOAPFactory(org.apache.axiom.soap.SOAPFactory) EndpointReference(org.apache.axis2.addressing.EndpointReference) SOAPMessageBodyBasedDispatcher(org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) HTTPClient4TransportSender(org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) AddressingBasedDispatcher(org.apache.axis2.dispatchers.AddressingBasedDispatcher) MessageContext(org.apache.axis2.context.MessageContext) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Example 3 with HTTPClient4TransportSender

use of org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender in project axis-axis2-java-core by apache.

the class MessageContextSelfManagedDataTest method prepare.

// 
// prepare the object hierarchy for testing
// 
private void prepare() throws Exception {
    // -----------------------------------------------------------------
    axisConfiguration = new AxisConfiguration();
    cfgContext = new ConfigurationContext(axisConfiguration);
    cfgContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/ns/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
    cfgContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/ns/wsdl/in-out", new RawXMLINOutMessageReceiver());
    DispatchPhase dispatchPhase = new DispatchPhase();
    dispatchPhase.setName("Dispatch");
    AddressingBasedDispatcher abd = new AddressingBasedDispatcher();
    abd.initDispatcher();
    RequestURIBasedDispatcher rud = new RequestURIBasedDispatcher();
    rud.initDispatcher();
    SOAPActionBasedDispatcher sabd = new SOAPActionBasedDispatcher();
    sabd.initDispatcher();
    SOAPMessageBodyBasedDispatcher smbd = new SOAPMessageBodyBasedDispatcher();
    smbd.initDispatcher();
    dispatchPhase.addHandler(abd);
    dispatchPhase.addHandler(rud);
    dispatchPhase.addHandler(sabd);
    dispatchPhase.addHandler(smbd);
    cfgContext.getAxisConfiguration().getInFlowPhases().add(dispatchPhase);
    // -----------------------------------------------------------------
    axisServiceGroup = new AxisServiceGroup(axisConfiguration);
    axisServiceGroup.setServiceGroupName("ServiceGroupTest");
    axisService = new AxisService(serviceName.getLocalPart());
    axisServiceGroup.addService(axisService);
    axisOperation = new InOutAxisOperation(operationName);
    axisOperation.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisService.addOperation(axisOperation);
    axisService.mapActionToOperation(operationName.getLocalPart(), axisOperation);
    cfgContext.getAxisConfiguration().addService(axisService);
    // -----------------------------------------------------------------
    serviceGroupContext = cfgContext.createServiceGroupContext(axisService.getAxisServiceGroup());
    serviceGroupContext.setId("ServiceGroupContextTest");
    serviceContext = serviceGroupContext.getServiceContext(axisService);
    operationContext = serviceContext.createOperationContext(operationName);
    // -----------------------------------------------------------------
    transportOut = new TransportOutDescription("null");
    transportOut2 = new TransportOutDescription("happy");
    transportOut3 = new TransportOutDescription("golucky");
    transportOut.setSender(new HTTPClient4TransportSender());
    transportOut2.setSender(new HTTPClient4TransportSender());
    transportOut3.setSender(new HTTPClient4TransportSender());
    axisConfiguration.addTransportOut(transportOut3);
    axisConfiguration.addTransportOut(transportOut2);
    axisConfiguration.addTransportOut(transportOut);
    transportIn = new TransportInDescription("null");
    transportIn2 = new TransportInDescription("always");
    transportIn3 = new TransportInDescription("thebest");
    transportIn.setReceiver(new SimpleHTTPServer());
    transportIn2.setReceiver(new SimpleHTTPServer());
    transportIn3.setReceiver(new SimpleHTTPServer());
    axisConfiguration.addTransportIn(transportIn2);
    axisConfiguration.addTransportIn(transportIn);
    axisConfiguration.addTransportIn(transportIn3);
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) RequestURIBasedDispatcher(org.apache.axis2.dispatchers.RequestURIBasedDispatcher) SOAPActionBasedDispatcher(org.apache.axis2.dispatchers.SOAPActionBasedDispatcher) AxisService(org.apache.axis2.description.AxisService) TransportInDescription(org.apache.axis2.description.TransportInDescription) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) SimpleHTTPServer(org.apache.axis2.transport.http.SimpleHTTPServer) AxisServiceGroup(org.apache.axis2.description.AxisServiceGroup) SOAPMessageBodyBasedDispatcher(org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) HTTPClient4TransportSender(org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) AddressingBasedDispatcher(org.apache.axis2.dispatchers.AddressingBasedDispatcher) MessageContext(org.apache.axis2.context.MessageContext) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Example 4 with HTTPClient4TransportSender

use of org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender in project axis-axis2-java-core by apache.

the class HttpTransportDescriptionFactory method createTransportOutDescription.

public TransportOutDescription createTransportOutDescription() throws Exception {
    TransportOutDescription desc = new TransportOutDescription("http");
    desc.setSender(new HTTPClient4TransportSender());
    return desc;
}
Also used : HTTPClient4TransportSender(org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Example 5 with HTTPClient4TransportSender

use of org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender in project axis-axis2-java-core by apache.

the class MessageContextSaveBTest method prepare.

// 
// prepare the object hierarchy for testing
// 
private void prepare() throws Exception {
    // -----------------------------------------------------------------
    // setup the top-level objects
    // -----------------------------------------------------------------
    axisConfiguration = new AxisConfiguration();
    configurationContext = new ConfigurationContext(axisConfiguration);
    configurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/ns/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
    configurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/ns/wsdl/in-out", new RawXMLINOutMessageReceiver());
    DispatchPhase dispatchPhase = new DispatchPhase();
    dispatchPhase.setName("Dispatch");
    AddressingBasedDispatcher abd = new AddressingBasedDispatcher();
    abd.initDispatcher();
    RequestURIBasedDispatcher rud = new RequestURIBasedDispatcher();
    rud.initDispatcher();
    SOAPActionBasedDispatcher sabd = new SOAPActionBasedDispatcher();
    sabd.initDispatcher();
    SOAPMessageBodyBasedDispatcher smbd = new SOAPMessageBodyBasedDispatcher();
    smbd.initDispatcher();
    dispatchPhase.addHandler(abd);
    dispatchPhase.addHandler(rud);
    dispatchPhase.addHandler(sabd);
    dispatchPhase.addHandler(smbd);
    configurationContext.getAxisConfiguration().getInFlowPhases().add(dispatchPhase);
    // ----------------------------
    // transport-related objects
    // ----------------------------
    transportOut = new TransportOutDescription("null");
    transportOut2 = new TransportOutDescription("happy");
    transportOut3 = new TransportOutDescription("golucky");
    transportOut.setSender(new HTTPClient4TransportSender());
    transportOut2.setSender(new HTTPClient4TransportSender());
    transportOut3.setSender(new HTTPClient4TransportSender());
    axisConfiguration.addTransportOut(transportOut3);
    axisConfiguration.addTransportOut(transportOut2);
    axisConfiguration.addTransportOut(transportOut);
    transportIn = new TransportInDescription("null");
    transportIn2 = new TransportInDescription("always");
    transportIn3 = new TransportInDescription("thebest");
    transportIn.setReceiver(new SimpleHTTPServer());
    transportIn2.setReceiver(new SimpleHTTPServer());
    transportIn3.setReceiver(new SimpleHTTPServer());
    axisConfiguration.addTransportIn(transportIn2);
    axisConfiguration.addTransportIn(transportIn);
    axisConfiguration.addTransportIn(transportIn3);
    // ----------------------------
    // phase-related objects
    // ----------------------------
    phase1 = new Phase("Phase1");
    phase1.addHandler(new TempHandler(1, 2));
    phase1.addHandler(new HandlerMCS(2, true));
    phase1.addHandler(new TempHandler(3, 2));
    ArrayList phases = new ArrayList();
    phases.add(phase1);
    axisConfiguration.setInPhasesUptoAndIncludingPostDispatch(phases);
    // -----------------------------------------------------------------
    // setup the axis side of the hierachy
    // -----------------------------------------------------------------
    // ABC group
    // ----------------------------
    axisSrvGrp_ABC = new AxisServiceGroup(axisConfiguration);
    axisSrvGrp_ABC.setServiceGroupName(serviceGroupName_ABC);
    axisSrv_A = new AxisService(service_QName_A.getLocalPart());
    axisSrv_B = new AxisService(service_QName_B.getLocalPart());
    axisSrv_C = new AxisService(service_QName_C.getLocalPart());
    axisSrvGrp_ABC.addService(axisSrv_A);
    axisSrvGrp_ABC.addService(axisSrv_B);
    axisSrvGrp_ABC.addService(axisSrv_C);
    axisOp_A1 = new InOutAxisOperation(operation_QName_A1);
    axisOp_A2 = new InOutAxisOperation(operation_QName_A2);
    axisOp_A1.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisOp_A2.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisSrv_A.addOperation(axisOp_A1);
    axisSrv_A.mapActionToOperation(operation_QName_A1.getLocalPart(), axisOp_A1);
    axisSrv_A.addOperation(axisOp_A2);
    axisSrv_A.mapActionToOperation(operation_QName_A2.getLocalPart(), axisOp_A2);
    axisConfiguration.addService(axisSrv_A);
    axisConfiguration.addService(axisSrv_B);
    axisConfiguration.addService(axisSrv_C);
    axisOp_A1.getRemainingPhasesInFlow().add(phase1);
    axisOp_A2.getRemainingPhasesInFlow().add(phase1);
    // ----------------------------
    // 123 group
    // ----------------------------
    axisSrvGrp_123 = new AxisServiceGroup(axisConfiguration);
    axisSrvGrp_123.setServiceGroupName(serviceGroupName_123);
    axisSrv_1 = new AxisService(service_QName_1.getLocalPart());
    axisSrv_2 = new AxisService(service_QName_2.getLocalPart());
    axisSrv_3 = new AxisService(service_QName_3.getLocalPart());
    axisSrv_4 = new AxisService(service_QName_4.getLocalPart());
    axisSrvGrp_123.addService(axisSrv_1);
    axisSrvGrp_123.addService(axisSrv_2);
    axisSrvGrp_123.addService(axisSrv_3);
    axisSrvGrp_123.addService(axisSrv_4);
    axisOp_1_1 = new InOutAxisOperation(operation_QName_1_1);
    axisOp_1_2 = new InOutAxisOperation(operation_QName_1_2);
    axisOp_1_1.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisOp_1_2.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisSrv_1.addOperation(axisOp_1_1);
    axisSrv_1.mapActionToOperation(operation_QName_1_1.getLocalPart(), axisOp_1_1);
    axisSrv_1.addOperation(axisOp_1_2);
    axisSrv_1.mapActionToOperation(operation_QName_1_2.getLocalPart(), axisOp_1_2);
    axisConfiguration.addService(axisSrv_1);
    axisConfiguration.addService(axisSrv_2);
    axisConfiguration.addService(axisSrv_3);
    axisConfiguration.addService(axisSrv_4);
    axisOp_1_1.getRemainingPhasesInFlow().add(phase1);
    axisOp_1_2.getRemainingPhasesInFlow().add(phase1);
    // ----------------------------
    // DAY group
    // ----------------------------
    axisSrvGrp_DAY = new AxisServiceGroup(axisConfiguration);
    axisSrvGrp_DAY.setServiceGroupName(serviceGroupName_DAY);
    axisSrv_Mon = new AxisService(service_QName_Mon.getLocalPart());
    axisSrv_Tue = new AxisService(service_QName_Tue.getLocalPart());
    axisSrv_Wed = new AxisService(service_QName_Wed.getLocalPart());
    axisSrv_Thu = new AxisService(service_QName_Thu.getLocalPart());
    axisSrv_Fri = new AxisService(service_QName_Fri.getLocalPart());
    axisSrvGrp_DAY.addService(axisSrv_Mon);
    axisSrvGrp_DAY.addService(axisSrv_Tue);
    axisSrvGrp_DAY.addService(axisSrv_Wed);
    axisSrvGrp_DAY.addService(axisSrv_Thu);
    axisSrvGrp_DAY.addService(axisSrv_Fri);
    axisOp_Mon_1 = new InOutAxisOperation(operation_QName_Mon_1);
    axisOp_Mon_2 = new InOutAxisOperation(operation_QName_Mon_2);
    axisOp_Mon_1.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisOp_Mon_2.setMessageReceiver(new MessageReceiver() {

        public void receive(MessageContext messageCtx) {
        }
    });
    axisSrv_Mon.addOperation(axisOp_Mon_1);
    axisSrv_Mon.mapActionToOperation(operation_QName_Mon_1.getLocalPart(), axisOp_Mon_1);
    axisSrv_Mon.addOperation(axisOp_Mon_2);
    axisSrv_Mon.mapActionToOperation(operation_QName_Mon_2.getLocalPart(), axisOp_Mon_2);
    axisConfiguration.addService(axisSrv_Mon);
    axisConfiguration.addService(axisSrv_Tue);
    axisConfiguration.addService(axisSrv_Wed);
    axisConfiguration.addService(axisSrv_Thu);
    axisConfiguration.addService(axisSrv_Fri);
    axisOp_Mon_1.getRemainingPhasesInFlow().add(phase1);
    axisOp_Mon_2.getRemainingPhasesInFlow().add(phase1);
    // -----------------------------------------------------------------
    // setup the context objects
    // -----------------------------------------------------------------
    srvGrpCtx_ABC = configurationContext.createServiceGroupContext(axisSrvGrp_ABC);
    srvGrpCtx_ABC.setId(serviceGroupName_ABC);
    srvGrpCtx_123 = configurationContext.createServiceGroupContext(axisSrvGrp_123);
    srvGrpCtx_123.setId(serviceGroupName_ABC);
    srvGrpCtx_DAY = configurationContext.createServiceGroupContext(axisSrvGrp_DAY);
    srvGrpCtx_DAY.setId(serviceGroupName_DAY);
    srvCtx_A = srvGrpCtx_ABC.getServiceContext(axisSrv_A);
    srvCtx_B = srvGrpCtx_ABC.getServiceContext(axisSrv_B);
    srvCtx_C = srvGrpCtx_ABC.getServiceContext(axisSrv_C);
    srvCtx_1 = srvGrpCtx_123.getServiceContext(axisSrv_1);
    srvCtx_2 = srvGrpCtx_123.getServiceContext(axisSrv_2);
    srvCtx_3 = srvGrpCtx_123.getServiceContext(axisSrv_3);
    srvCtx_4 = srvGrpCtx_123.getServiceContext(axisSrv_4);
    srvCtx_Mon = srvGrpCtx_DAY.getServiceContext(axisSrv_Mon);
    srvCtx_Tue = srvGrpCtx_DAY.getServiceContext(axisSrv_Tue);
    srvCtx_Wed = srvGrpCtx_DAY.getServiceContext(axisSrv_Wed);
    srvCtx_Thu = srvGrpCtx_DAY.getServiceContext(axisSrv_Thu);
    srvCtx_Fri = srvGrpCtx_DAY.getServiceContext(axisSrv_Fri);
    opCtx_A1 = srvCtx_A.createOperationContext(operation_QName_A1);
    opCtx_A2 = srvCtx_A.createOperationContext(operation_QName_A2);
    opCtx_1_1 = srvCtx_1.createOperationContext(operation_QName_1_1);
    opCtx_1_2 = srvCtx_1.createOperationContext(operation_QName_1_2);
    opCtx_Mon_1 = srvCtx_Mon.createOperationContext(operation_QName_Mon_1);
    opCtx_Mon_2 = srvCtx_Mon.createOperationContext(operation_QName_Mon_2);
    // ----------------------------------------
    // message context objects
    // ----------------------------------------
    msgCtx_A1 = createMessageContext(opCtx_A1);
    msgCtx_A2 = createMessageContext(opCtx_A2);
    msgCtx_1_1 = createMessageContext(opCtx_1_1);
    msgCtx_1_2 = createMessageContext(opCtx_1_2);
    msgCtx_Mon_1 = createMessageContext(opCtx_Mon_1);
    msgCtx_Mon_2 = createMessageContext(opCtx_Mon_2);
    // -----------------------------------------------------------------
    // other objects
    // -----------------------------------------------------------------
    executedHandlers = new ArrayList();
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) RequestURIBasedDispatcher(org.apache.axis2.dispatchers.RequestURIBasedDispatcher) SOAPActionBasedDispatcher(org.apache.axis2.dispatchers.SOAPActionBasedDispatcher) AxisService(org.apache.axis2.description.AxisService) ArrayList(java.util.ArrayList) TransportInDescription(org.apache.axis2.description.TransportInDescription) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) SimpleHTTPServer(org.apache.axis2.transport.http.SimpleHTTPServer) AxisServiceGroup(org.apache.axis2.description.AxisServiceGroup) SOAPMessageBodyBasedDispatcher(org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher) RawXMLINOnlyMessageReceiver(org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) HTTPClient4TransportSender(org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender) RawXMLINOutMessageReceiver(org.apache.axis2.receivers.RawXMLINOutMessageReceiver) AddressingBasedDispatcher(org.apache.axis2.dispatchers.AddressingBasedDispatcher) MessageContext(org.apache.axis2.context.MessageContext) InOutAxisOperation(org.apache.axis2.description.InOutAxisOperation) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Aggregations

TransportOutDescription (org.apache.axis2.description.TransportOutDescription)8 HTTPClient4TransportSender (org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender)8 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)7 TransportInDescription (org.apache.axis2.description.TransportInDescription)7 MessageContext (org.apache.axis2.context.MessageContext)6 AxisService (org.apache.axis2.description.AxisService)6 InOutAxisOperation (org.apache.axis2.description.InOutAxisOperation)6 AxisServiceGroup (org.apache.axis2.description.AxisServiceGroup)5 AddressingBasedDispatcher (org.apache.axis2.dispatchers.AddressingBasedDispatcher)5 RequestURIBasedDispatcher (org.apache.axis2.dispatchers.RequestURIBasedDispatcher)5 SOAPActionBasedDispatcher (org.apache.axis2.dispatchers.SOAPActionBasedDispatcher)5 SOAPMessageBodyBasedDispatcher (org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher)5 RawXMLINOnlyMessageReceiver (org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver)5 RawXMLINOutMessageReceiver (org.apache.axis2.receivers.RawXMLINOutMessageReceiver)5 SimpleHTTPServer (org.apache.axis2.transport.http.SimpleHTTPServer)5 ArrayList (java.util.ArrayList)4 SOAPFactory (org.apache.axiom.soap.SOAPFactory)3 EndpointReference (org.apache.axis2.addressing.EndpointReference)3 ServiceContext (org.apache.axis2.context.ServiceContext)2 File (java.io.File)1