Search in sources :

Example 11 with Endpoint

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

Example 12 with Endpoint

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

Example 13 with 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);
    }
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) InetSocketAddress(java.net.InetSocketAddress) HttpServer(com.sun.net.httpserver.HttpServer) ExecutorService(java.util.concurrent.ExecutorService) HttpContext(com.sun.net.httpserver.HttpContext) Endpoint(jakarta.xml.ws.Endpoint)

Example 14 with Endpoint

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

Example 15 with Endpoint

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

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