use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class MapServiceTest method testStringGenericsMapService.
/**
* Test string generics map service.
*
* @throws XMLStreamException
* the xML stream exception
* @throws AxisFault
* the axis fault
*/
@Test
public void testStringGenericsMapService() throws XMLStreamException, AxisFault {
String epr = server.getEndpoint("MapService") + "/stringGenericsMapService";
Options options = new Options();
options.setTo(new EndpointReference(epr));
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement msg = createMessageBody("stringGenericsMapService");
OMElement ret = sender.sendReceive(msg);
assertNotNull("Response can not be null", ret);
assertEquals("Not the expeacted value", "stringGenericsMapServiceResponse", ret.getLocalName());
assertNotNull("Element can not be null", ret.getFirstElement().getFirstElement());
assertEquals("Not the expeacted value", msg.getFirstElement().getFirstElement().toString(), ret.getFirstElement().getFirstElement().toString());
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class DescriptionFactoryImpl method updateEndpoint.
/**
* @see org.apache.axis2.jaxws.description.DescriptionFactory#updateEndpoint(ServiceDescription,
* Class, EndpointReference, String, DescriptionFactory.UpdateType, DescriptionBuilderComposite, Object)
*/
public static EndpointDescription updateEndpoint(ServiceDescription serviceDescription, Class sei, EndpointReference epr, String addressingNamespace, DescriptionFactory.UpdateType updateType, DescriptionBuilderComposite composite, Object sparseCompositeKey, String bindingId, String endpointAddress) {
QName portQName = null;
try {
ServiceName serviceName = EndpointReferenceHelper.getServiceNameMetadata(epr, addressingNamespace);
QName serviceQName = serviceDescription.getServiceQName();
// match the service name associated with the JAX-WS service instance.
if (serviceName.getName() != null && !serviceQName.equals(serviceName.getName())) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceNameMismatch", serviceName.getName().toString(), serviceQName.toString()));
}
// leave it to the runtime to find a suitable port, based on WSDL/annotations.
if (serviceName.getEndpointName() != null) {
portQName = new QName(serviceQName.getNamespaceURI(), serviceName.getEndpointName());
}
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("updateEndpointError", e.getMessage()));
}
return updateEndpoint(serviceDescription, sei, portQName, updateType, composite, sparseCompositeKey, bindingId, endpointAddress);
}
use of org.apache.axis2.addressing.EndpointReference 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();
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class MessageContextSelfManagedDataTest method testPause04_saveRestoreAxisService.
/**
* Test for save and restore of self managed data and the AxisService
*/
public void testPause04_saveRestoreAxisService() {
log.debug("MessageContextSelfManagedDataTest::testPause04_saveRestoreAxisService()=======================================");
try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine.receive(mc);
} catch (Exception e) {
e.printStackTrace();
}
// make sure the service got restored in the MessageContext object
assertEquals(serviceName.toString(), mc.getAxisService().getName().toString());
assertEquals(1, invokecallcount);
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class MessageContextSelfManagedDataTest method testPause05_saveRestoreAxisServiceGroup.
/**
* Test for save and restore of self managed data and the AxisServiceGroup
*/
public void testPause05_saveRestoreAxisServiceGroup() {
log.debug("MessageContextSelfManagedDataTest::testPause05_saveRestoreAxisServiceGroup()=======================================");
try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine.receive(mc);
} catch (Exception e) {
e.printStackTrace();
}
// make sure the serviceGroup got restored in the MessageContext object
// assertEquals(serviceGroupName.toString(), mc.getAxisServiceGroup().getServiceGroupName());
assertEquals(1, invokecallcount);
}
Aggregations