use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class MessageContextTest method testHttpProperties.
public void testHttpProperties() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/hello";
Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, new MessageContextProvider());
e.publish(address);
URL url = new URL(address + "/a/b?a=b");
InputStream in = url.openStream();
BufferedReader rdr = new BufferedReader(new InputStreamReader(in));
String str;
while ((str = rdr.readLine()) != null) ;
e.stop();
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class EndpointFeaturesTest method testPublish.
// Tests Endpoint.publish(address, impl, features)
public void testPublish() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/hello";
Endpoint endpoint = Endpoint.publish(address, new FeaturesEndpoint(), new AddressingFeature(true, true, AddressingFeature.Responses.ANONYMOUS));
assertTrue(endpoint.isPublished());
publishVerifyStop(address, endpoint);
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class HttpContextTest method testContext.
public void testContext() throws Exception {
try {
HttpAdapter.setPublishStatus(true);
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/hello";
HttpServer server = HttpServer.create(new InetSocketAddress(port), 5);
ExecutorService threads = Executors.newFixedThreadPool(5);
server.setExecutor(threads);
server.start();
Endpoint endpoint = Endpoint.create(new RpcLitEndpoint());
HttpContext context = server.createContext("/hello");
endpoint.publish(context);
// access HTML page and check the wsdl location
String wsdlAddress = address + "?wsdl";
String str = getHtmlPage(address);
assertTrue(str + "doesn't have " + wsdlAddress, str.contains(wsdlAddress));
// See if WSDL is published at the correct address
int code = getHttpStatusCode(wsdlAddress);
assertEquals(HttpURLConnection.HTTP_OK, code);
// Check abstract wsdl address
String wsdlImportAddress = getWsdlImportAddress(wsdlAddress);
assertEquals(address + "?wsdl=1", wsdlImportAddress);
// See if abstract WSDL is published at the correct address
code = getHttpStatusCode(wsdlImportAddress);
assertEquals(HttpURLConnection.HTTP_OK, code);
// Check published web service soap address
String pubAddress = getSoapAddress(wsdlAddress);
assertEquals(address, pubAddress);
// Invoke service
invoke(address);
endpoint.stop();
server.stop(1);
threads.shutdown();
} finally {
HttpAdapter.setPublishStatus(false);
}
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class MessageContextTest method testMessageContext.
public void testMessageContext() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/";
Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, new MyProvider());
e.publish(address);
URL url = new URL(address);
InputStream in = url.openStream();
BufferedReader rdr = new BufferedReader(new InputStreamReader(in));
String str;
while ((str = rdr.readLine()) != null) ;
e.stop();
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class ProviderTest method testProviderEndpoint.
public void testProviderEndpoint() {
int port = PortAllocator.getFreePort();
String address = "http://127.0.0.1:" + port + "/";
Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, new MyProvider());
e.publish(address);
// TODO add dispatch client to access this endpoint
e.stop();
}
Aggregations