Search in sources :

Example 1 with Endpoint

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);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) File(java.io.File)

Example 2 with 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);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint)

Example 3 with 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;
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) WSEndpoint(com.sun.xml.ws.api.server.WSEndpoint) BoundEndpoint(com.sun.xml.ws.api.server.BoundEndpoint) EndpointImpl(com.sun.xml.ws.transport.http.server.EndpointImpl)

Example 4 with 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();
}
Also used : TransformerFactory(javax.xml.transform.TransformerFactory) Transformer(javax.xml.transform.Transformer) Endpoint(jakarta.xml.ws.Endpoint) StreamResult(javax.xml.transform.stream.StreamResult) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Endpoint(jakarta.xml.ws.Endpoint) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Example 5 with Endpoint

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();
}
Also used : TransformerFactory(javax.xml.transform.TransformerFactory) Transformer(javax.xml.transform.Transformer) Endpoint(jakarta.xml.ws.Endpoint) StreamResult(javax.xml.transform.stream.StreamResult) Endpoint(jakarta.xml.ws.Endpoint) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Aggregations

Endpoint (jakarta.xml.ws.Endpoint)90 URL (java.net.URL)25 Source (javax.xml.transform.Source)22 StreamSource (javax.xml.transform.stream.StreamSource)22 ArrayList (java.util.ArrayList)16 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)10 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)10 QName (javax.xml.namespace.QName)7 HttpContext (com.sun.net.httpserver.HttpContext)6 HttpServer (com.sun.net.httpserver.HttpServer)5 InetSocketAddress (java.net.InetSocketAddress)5 HashMap (java.util.HashMap)5 ExecutorService (java.util.concurrent.ExecutorService)5 HTTPResponseInfo (testutil.HTTPResponseInfo)5 EndpointImpl (com.sun.xml.ws.transport.http.server.EndpointImpl)4 EndpointReference (jakarta.xml.ws.EndpointReference)4 Transformer (javax.xml.transform.Transformer)4 TransformerFactory (javax.xml.transform.TransformerFactory)4 StreamResult (javax.xml.transform.stream.StreamResult)4 WSEndpoint (com.sun.xml.ws.api.server.WSEndpoint)3