use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class J2SETester method main.
public static void main(String[] args) throws Exception {
File file = new File("etc/external-metadata.xml");
WebServiceFeature feature = ExternalMetadataFeature.builder().addFiles(file).build();
Endpoint endpoint = Endpoint.create(new BlackboxService(), feature);
endpoint.publish("http://localhost:8080/jaxws-external-metadata-fromjava/WS");
// Stops the endpoint if it receives request http://localhost:9090/stop
new EndpointStopper(9090, endpoint);
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class AddWebservice method main.
public static void main(String[] args) throws Exception {
Endpoint endpoint = Endpoint.publish("http://localhost:8080/jaxws-fromjava/addnumbers", new AddNumbersImpl());
// Stops the endpoint if it receives request http://localhost:9090/stop
new EndpointStopper(9090, endpoint);
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class ProviderImpl method createAndPublishEndpoint.
public Endpoint createAndPublishEndpoint(String address, Object implementor, WebServiceFeature... features) {
Endpoint endpoint = new EndpointImpl(BindingID.parse(implementor.getClass()), implementor, features);
endpoint.publish(address);
return endpoint;
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class SourceTest method testSource.
public void testSource() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/source";
Endpoint endpoint = Endpoint.create(new SourceEndpoint());
endpoint.publish(address);
Source response = invoke(address);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.transform(response, new StreamResult(bos));
bos.close();
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(bos.toByteArray()));
while (reader.hasNext()) {
reader.next();
}
endpoint.stop();
}
use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.
the class WhitespaceTest method testSource.
public void testSource() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/source";
Endpoint endpoint = Endpoint.create(new WhitespaceEndpoint());
endpoint.publish(address);
Source response = invoke(address);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.transform(response, new StreamResult(bos));
bos.close();
assertTrue(new String(bos.toByteArray()).contains("30"));
endpoint.stop();
}
Aggregations