Search in sources :

Example 26 with Endpoint

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

the class EndpointEPRTester method testDefaultEPR.

public void testDefaultEPR() throws Exception {
    int port = Util.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.create(new RpcLitEndpoint());
    endpoint.publish(address);
    EndpointReference epr = endpoint.getEndpointReference();
    endpoint.stop();
    EprUtil.validateEPR(epr, address, null, /*serviceName*/
    null, /*portName*/
    null, /*portTypeName*/
    Boolean.FALSE);
    printEPR(epr);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference)

Example 27 with Endpoint

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

the class EndpointEPRTester method testMSEPR.

public void testMSEPR() 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);
    MemberSubmissionEndpointReference epr = endpoint.getEndpointReference(MemberSubmissionEndpointReference.class);
    endpoint.stop();
    EprUtil.validateEPR(epr, address, serviceName, portName, portTypeName, Boolean.TRUE);
    printEPR(epr);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) StreamSource(javax.xml.transform.stream.StreamSource) ArrayList(java.util.ArrayList) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) Endpoint(jakarta.xml.ws.Endpoint) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) URL(java.net.URL)

Example 28 with Endpoint

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

the class EndpointEPRTester method testDefaultEPRWithWSDL.

public void testDefaultEPRWithWSDL() 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);
    EndpointReference epr = endpoint.getEndpointReference();
    endpoint.stop();
    EprUtil.validateEPR(epr, address, null, /*serviceName*/
    null, /*portName*/
    null, /* portTypeName */
    Boolean.FALSE);
    printEPR(epr);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) 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) W3CEndpointReference(jakarta.xml.ws.wsaddressing.W3CEndpointReference) MemberSubmissionEndpointReference(com.sun.xml.ws.developer.MemberSubmissionEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference)

Example 29 with Endpoint

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

the class EndpointExecutorTester method testExecutor.

public void testExecutor() throws Exception {
    int port = Util.getFreePort();
    String address = "http://127.0.0.1:" + port + "/exe";
    Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, new MyProvider());
    MyExecutor executor = new MyExecutor();
    e.setExecutor(executor);
    e.publish(address);
    // Make GET request for WSDL. But no WSDL is published for this endpoint
    assertEquals(getHttpStatusCode(address), HttpURLConnection.HTTP_NOT_FOUND);
    // Check whether MyExecutor is invoked or not
    assertTrue(executor.isExecuted());
    e.stop();
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) Endpoint(jakarta.xml.ws.Endpoint)

Example 30 with Endpoint

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

the class EndpointWsdlLocationTester method testWsdlLocation.

// endpoint has wsdlLocation="...". It publishes the same wsdl, metadata
// docs
public void testWsdlLocation() throws Exception {
    int port = Util.getFreePort();
    String address = "http://localhost:" + port + "/hello";
    Endpoint endpoint = Endpoint.create(new RpcLitEndpointWsdlLocation());
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    String[] docs = { "WEB-INF/wsdl/RpcLitAbstract.wsdl", "WEB-INF/wsdl/RpcLitEndpoint.xsd" };
    List<Source> metadata = new ArrayList<Source>();
    for (String doc : docs) {
        URL url = cl.getResource(doc);
        metadata.add(new StreamSource(url.openStream(), url.toExternalForm()));
    }
    endpoint.setMetadata(metadata);
    endpoint.publish(address);
    URL pubUrl = new URL(address + "?wsdl");
    boolean gen = isGenerated(pubUrl.openStream());
    assertFalse(gen);
    pubUrl = new URL(address + "?wsdl=1");
    gen = isGenerated(pubUrl.openStream());
    assertFalse(gen);
    pubUrl = new URL(address + "?xsd=1");
    gen = isGenerated(pubUrl.openStream());
    assertFalse(gen);
    invoke(address);
    endpoint.stop();
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) 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)

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