use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class ServiceCreateTest method testServiceCreate.
public void testServiceCreate() throws AxisFault {
AxisConfiguration axisConfig = configContext.getAxisConfiguration();
AxisService service = AxisService.createService("org.apache.axis2.engine.MyService", axisConfig);
assertNotNull(service);
axisConfig.addService(service);
assertEquals("MyService", service.getName());
AxisOperation axisOperation = service.getOperation(new QName("add"));
assertNotNull(axisOperation);
AxisMessage messge = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
// messge.getSchemaElement().toString()
assertNotNull(messge);
assertNotNull(messge.getSchemaElement());
assertNotNull(service.getOperation(new QName("putValue")));
assertNotNull(axisConfig.getService("MyService"));
RPCServiceClient client = new RPCServiceClient(clinetConfigurationctx, null);
EndpointReference targetEPR = new EndpointReference("http://127.0.0.1:" + (UtilServer.TESTING_PORT) + "/axis2/services/MyService/add");
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
client.setOptions(options);
ArrayList args = new ArrayList();
args.add("100");
args.add("200");
OMElement response = client.invokeBlocking(new QName("http://engine.axis2.apache.org", "add", "ns1"), args.toArray());
assertEquals(Integer.parseInt(response.getFirstElement().getText()), 300);
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class ServiceFaultTest method setUp.
protected void setUp() throws Exception {
service = Utils.createSimpleService(serviceName, FaultThrowingService.class.getName(), operationName);
UtilServer.deployService(service);
targetEPR = new EndpointReference("http://127.0.0.1:" + (UtilServer.TESTING_PORT) + // "http://127.0.0.1:5556"
"/axis2/services/" + serviceName.getLocalPart() + "/" + operationName.getLocalPart());
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class FastInfosetTest method suite.
public static Test suite() {
return new TestSetup(new TestSuite(FastInfosetTest.class)) {
public void setUp() throws Exception {
System.out.println("Setting up the Simple HTTP Server");
int port = findAvailablePort();
// Uncomment to test with tcpmon
port = 5555;
target = new EndpointReference("http://127.0.0.1:" + (port) + "/axis2/services/SimpleAddService");
File configFile = new File(System.getProperty("basedir", ".") + "/test-resources/axis2.xml");
configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes", configFile.getAbsolutePath());
server = new SimpleHTTPServer(configurationContext, port);
server.start();
service = AxisService.createService("org.apache.axis2.fastinfoset.SimpleAddService", server.getConfigurationContext().getAxisConfiguration());
server.getConfigurationContext().getAxisConfiguration().addService(service);
System.out.println("Simple HTTP Server is started");
}
public void tearDown() throws Exception {
server.stop();
System.out.println("Stopped the Simple HTTP Server");
}
};
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class OneWayRawXMLTest method testOneWay.
public void testOneWay() throws Exception {
ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(TestingUtils.prefixBaseDirectory(Constants.TESTING_PATH + "integrationRepo/"), null);
ServiceClient sender = new ServiceClient(configContext, null);
Options op = new Options();
// op.setTo(new EndpointReference(
// // "http://127.0.0.1:" + (UtilServer.TESTING_PORT)
// "http://127.0.0.1:" + 5556
// + "/axis2/services/"+service.getName()+"/"+operationName.getLocalPart()));
op.setTo(targetEPR);
op.setAction("urn:SomeAction");
sender.setOptions(op);
sender.fireAndForget(TestingUtils.createDummyOMElement());
int index = 0;
while (!received) {
Thread.sleep(1000);
index++;
if (index == 20) {
throw new AxisFault("error Occured");
}
}
}
use of org.apache.axis2.addressing.EndpointReference in project axis-axis2-java-core by apache.
the class MapServiceTest method testStringGenericsTreeMapService.
/**
* Test string generics tree map service.
*
* @throws XMLStreamException
* the xML stream exception
* @throws AxisFault
* the axis fault
*/
@Test
public void testStringGenericsTreeMapService() throws XMLStreamException, AxisFault {
String epr = server.getEndpoint("MapService") + "/stringGenericsTreeMapService";
Options options = new Options();
options.setTo(new EndpointReference(epr));
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement msg = createMessageBody("stringGenericsTreeMapService");
OMElement ret = sender.sendReceive(msg);
assertNotNull("Response can not be null", ret);
assertEquals("Not the expeacted value", "stringGenericsTreeMapServiceResponse", ret.getLocalName());
assertNotNull("Element can not be null", ret.getFirstElement().getFirstElement());
assertEquals("Not the expeacted value", msg.getFirstElement().getFirstElement().toString(), ret.getFirstElement().getFirstElement().toString());
}
Aggregations