1 16 17 package org.apache.axis2.engine; 18 19 import org.apache.axis2.addressing.AddressingConstants; 20 import org.apache.axis2.addressing.EndpointReference; 21 import org.apache.axis2.context.ConfigurationContext; 22 import org.apache.axis2.context.MessageContext; 23 import org.apache.axis2.context.OperationContextFactory; 24 import org.apache.axis2.context.ServiceContext; 25 import org.apache.axis2.description.OperationDescription; 26 import org.apache.axis2.description.ServiceDescription; 27 import org.apache.axis2.description.TransportInDescription; 28 import org.apache.axis2.description.TransportOutDescription; 29 import org.apache.axis2.om.OMAbstractFactory; 30 import org.apache.axis2.soap.SOAPFactory; 31 import org.apache.axis2.transport.http.HTTPTransportSender; 32 import org.apache.wsdl.WSDLConstants; 33 import org.apache.wsdl.WSDLService; 34 35 import javax.xml.namespace.QName ; 36 import java.util.ArrayList ; 37 38 public class EngineWithoutPhaseResolvingTest extends AbstractEngineTest { 39 private MessageContext mc; 40 private ArrayList executedHandlers = new ArrayList (); 41 private AxisConfiguration engineRegistry; 42 private QName serviceName = new QName ("axis/services/NullService"); 43 private QName opearationName = new QName ("NullOperation"); 44 private ServiceDescription service; 45 private ConfigurationContext engineContext; 46 private OperationDescription axisOp; 47 48 public EngineWithoutPhaseResolvingTest() { 49 } 50 51 public EngineWithoutPhaseResolvingTest(String arg0) { 52 super(arg0); 53 } 54 55 protected void setUp() throws Exception { 56 57 engineRegistry = new AxisConfigurationImpl(); 58 engineContext = new ConfigurationContext(engineRegistry); 59 60 TransportOutDescription transport = new TransportOutDescription(new QName ("null")); 61 transport.setSender(new HTTPTransportSender()); 62 63 TransportInDescription transportIn = new TransportInDescription(new QName ("null")); 64 axisOp = new OperationDescription(opearationName); 65 66 service = new ServiceDescription(serviceName); 67 axisOp.setMessageReciever(new MessageReceiver() { 68 public void recieve(MessageContext messgeCtx) throws AxisFault { 69 71 } 72 }); 73 engineRegistry.addService(service); 74 service.setStyle(WSDLService.STYLE_DOC); 75 service.addOperation(axisOp); 76 77 ServiceContext serviceContext = engineContext.createServiceContext(serviceName); 78 79 mc = 80 new MessageContext(engineContext, 81 transportIn, 82 transport); 83 84 mc.setOperationContext(OperationContextFactory.createMEPContext(WSDLConstants.MEP_CONSTANT_IN_OUT, axisOp, serviceContext)); 85 mc.setTransportOut(transport); 86 mc.setProperty(MessageContext.TRANSPORT_OUT, System.out); 87 mc.setServerSide(true); 88 SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory(); 89 mc.setEnvelope(omFac.getDefaultEnvelope()); 90 91 92 mc.setWSAAction(opearationName.getLocalPart()); 93 mc.setSoapAction(opearationName.getLocalPart()); 94 System.out.flush(); 95 } 96 97 112 public void testServerReceive() throws Exception { 113 mc.setTo(new EndpointReference(AddressingConstants.WSA_TO, "axis/services/NullService")); 114 AxisEngine engine = new AxisEngine(engineContext); 115 mc.setServerSide(true); 116 engine.receive(mc); 117 } 118 } 127 | Popular Tags |