Search in sources :

Example 76 with Endpoint

use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.

the class EndpointAPITester method testEndpoint1.

public void testEndpoint1() {
    int port = Util.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.create(new RpcLitEndpoint());
    endpoint.publish(address);
    doAPItesting(endpoint);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint)

Example 77 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 78 with Endpoint

use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.

the class OnewayTest method testOneway.

public void testOneway() throws Exception {
    int port = PortAllocator.getFreePort();
    String address = "http://localhost:" + port + "/oneway";
    Endpoint endpoint = Endpoint.create(new OnewayEndpoint());
    endpoint.publish(address);
    int status = getHttpStatus(address);
    assertEquals(202, status);
    // Commenting this out. It's possible that
    // verifyInteger() could be called before echoInteger()
    // since 202 is sent before invoking echoInteger
    // assertTrue(verify(address).contains("12345"));
    endpoint.stop();
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint)

Example 79 with Endpoint

use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.

the class SourceTest method testServiceCreateUsingInMemorySource.

/**
 * This test ensures that when a valid Source object is provided to the JAX-WS client for
 * the WSDL, it gets used instead of going over the wire to read from the WSDL URL
 * (Associated change is in RuntimeWSDLParser.resolveWSDL)
 *
 * The test first reads the WSDL into an in-memory Source object and uses that
 * to construct the Service delegate (using WSServiceDelegate constructor since
 * no standard API is available). It then creates the service with this Source and makes
 * sure that the InputStream underlying the Source has been consumed
 *
 * @throws Exception
 */
public void testServiceCreateUsingInMemorySource() throws Exception {
    int port = PortAllocator.getFreePort();
    String address = "http://localhost:" + port + "/source2";
    Endpoint endpoint = Endpoint.create(new SourceEndpoint());
    endpoint.publish(address);
    QName portName = new QName(NS, "RpcLitPort");
    QName serviceName = new QName(NS, "RpcLitEndpoint");
    StreamSource wsdlSource = readWsdlToInMemorySource(address + "?wsdl");
    WSServiceDelegate svcDel = new WSServiceDelegate(wsdlSource, serviceName, Service.class);
    byte[] b = new byte[512];
    int len = wsdlSource.getInputStream().read(b);
    assertTrue("In-memory WSDL Source passed to client must be consumed!", len < 0);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) QName(javax.xml.namespace.QName) WSServiceDelegate(com.sun.xml.ws.client.WSServiceDelegate) StreamSource(javax.xml.transform.stream.StreamSource) Endpoint(jakarta.xml.ws.Endpoint)

Example 80 with Endpoint

use of jakarta.xml.ws.Endpoint in project metro-jax-ws by eclipse-ee4j.

the class EndpointWsdlLocationTest method testHtmlPage.

public void testHtmlPage() throws Exception {
    try {
        HttpAdapter.setPublishStatus(true);
        int port = PortAllocator.getFreePort();
        String address = "http://localhost:" + port + "/hello";
        Endpoint endpoint = Endpoint.create(new RpcLitEndpointWsdlLocation());
        endpoint.publish(address);
        URL pubUrl = new URL(address);
        URLConnection con = pubUrl.openConnection();
        InputStream is = con.getInputStream();
        int ch;
        while ((ch = is.read()) != -1) ;
        assertTrue(con.getContentType().contains("text/html"));
        endpoint.stop();
    } finally {
        HttpAdapter.setPublishStatus(false);
    }
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint) URL(java.net.URL) URLConnection(java.net.URLConnection)

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