Search in sources :

Example 21 with Endpoint

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

the class DynamicExceptionMappingTest method testDynamicExceptionMapping.

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

Example 22 with Endpoint

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

the class DynamicExceptionMappingTest method testNegativeDynamicExceptionMapping.

public void testNegativeDynamicExceptionMapping() throws Exception {
    int port = Util.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.create(new NegativeEchoImpl());
    try {
        endpoint.publish(address);
        fail("Should have thrown exception");
    } catch (RuntimeModelerException e) {
        assertTrue(e.getMessage().contains("Oneway operation should not throw any checked exceptions"));
    } finally {
        endpoint.stop();
    }
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) RuntimeModelerException(com.sun.xml.ws.model.RuntimeModelerException) Endpoint(jakarta.xml.ws.Endpoint)

Example 23 with Endpoint

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

the class EndpointStopper method main.

public static void main(String[] args) throws Throwable {
    Endpoint e = deploy();
    System.out.println("Endpoint [" + e + "] successfully deployed.");
    System.out.println("Deploying endpoint STOPPER to [http://localhost:" + STOP_PORT + "/stop]");
    new EndpointStopper(STOP_PORT, e);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint)

Example 24 with Endpoint

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

the class EndpointEPRTester method testW3CEPR.

public void testW3CEPR() throws Exception {
    int port = Util.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.create(new RpcLitEndpoint());
    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()));
    }
    endpoint.setMetadata(metadata);
    endpoint.publish(address);
    W3CEndpointReference epr = endpoint.getEndpointReference(W3CEndpointReference.class);
    endpoint.stop();
    EprUtil.validateEPR(epr, address, null, /*serviceName*/
    null, /*portName*/
    null, /*portTypeName*/
    Boolean.FALSE);
    printEPR(epr);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) StreamSource(javax.xml.transform.stream.StreamSource) ArrayList(java.util.ArrayList) Endpoint(jakarta.xml.ws.Endpoint) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) URL(java.net.URL)

Example 25 with Endpoint

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

the class EndpointEPRTester method testProviderEndpointW3CEPR_WSDL.

public void testProviderEndpointW3CEPR_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);
    W3CEndpointReference epr = e.getEndpointReference(W3CEndpointReference.class);
    e.stop();
    // EprUtil.validateEPR(epr, address, serviceName, portName, portTypeName, Boolean.TRUE );
    EprUtil.validateEPR(epr, address, null, null, null, false);
    printEPR(epr);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) ArrayList(java.util.ArrayList) Endpoint(jakarta.xml.ws.Endpoint) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) URL(java.net.URL) Endpoint(jakarta.xml.ws.Endpoint) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference)

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