use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class HttpContextTester method testContext.
public void testContext() throws Exception {
int port = Util.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);
// Gets WSDL from the published endpoint
int code = getHttpStatusCode(address);
assertEquals(HttpURLConnection.HTTP_OK, code);
endpoint.stop();
server.stop(1);
threads.shutdown();
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class HttpStatusCodes method testUnsupportedMediaType.
public void testUnsupportedMediaType() throws Exception {
int port = Util.getFreePort();
String address = "http://localhost:" + port + "/hello";
Endpoint endpoint = Endpoint.publish(address, new RpcLitEndpoint());
// Send a request with "a/b" as Content-Type
String message = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body/></soapenv:Envelope>";
HTTPResponseInfo rInfo = ClientServerTestUtil.sendPOSTRequest(address, message, "a/b");
int code = rInfo.getResponseCode();
assertEquals(HttpURLConnection.HTTP_UNSUPPORTED_TYPE, code);
endpoint.stop();
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class MessageContextTester method testHttpProperties.
public void testHttpProperties() throws Exception {
int port = Util.getFreePort();
String address = "http://127.0.0.1:" + 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 EndpointEPRTester method testProviderEndpointMSCEPR_WSDL.
public void testProviderEndpointMSCEPR_WSDL() throws Exception {
int port = Util.getFreePort();
String address = "http://127.0.0.1:" + port + "/";
Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, new MyProvider());
List<Source> metadata = new ArrayList<Source>();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
String[] docs = { "WEB-INF/wsdl/RpcLitEndpoint.wsdl", "WEB-INF/wsdl/RpcLitAbstract.wsdl", "WEB-INF/wsdl/RpcLitEndpoint.xsd" };
for (String doc : docs) {
URL url = cl.getResource(doc);
metadata.add(new StreamSource(url.openStream(), url.toExternalForm()));
}
e.setMetadata(metadata);
Map<String, Object> endpointProps = new HashMap<String, Object>();
endpointProps.put(Endpoint.WSDL_SERVICE, new QName("http://echo.org/", "RpcLitEndpoint"));
endpointProps.put(Endpoint.WSDL_PORT, new QName("http://echo.org/", "RpcLitPort"));
e.setProperties(endpointProps);
e.publish(address);
MemberSubmissionEndpointReference epr = e.getEndpointReference(MemberSubmissionEndpointReference.class);
e.stop();
EprUtil.validateEPR(epr, address, serviceName, portName, portTypeName, Boolean.TRUE);
printEPR(epr);
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class EndpointEPRTester method testProviderEndpointW3CEPR.
public void testProviderEndpointW3CEPR() {
int port = Util.getFreePort();
String address = "http://127.0.0.1:" + port + "/";
Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, new MyProvider());
e.publish(address);
W3CEndpointReference epr = e.getEndpointReference(W3CEndpointReference.class);
e.stop();
printEPR(epr);
EprUtil.validateEPR(epr, address, null, null, null, Boolean.FALSE);
}
Aggregations