Java Code Examples for javax.xml.ws.Endpoint#stop()
The following examples show how to use
javax.xml.ws.Endpoint#stop() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CallbackClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testCallback() throws Exception { Object implementor = new CallbackImpl(); String address = "http://localhost:" + CB_PORT + "/CallbackContext/CallbackPort"; Endpoint ep = Endpoint.publish(address, implementor); URL wsdlURL = getClass().getResource("/wsdl/basic_callback_test.wsdl"); SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME); ServerPortType port = ss.getPort(PORT_NAME, ServerPortType.class); updateAddressPort(port, PORT); EndpointReference w3cEpr = ep.getEndpointReference(); String resp = port.registerCallback((W3CEndpointReference)w3cEpr); assertEquals("registerCallback called", resp); ep.stop(); }
Example 2
Source File: EndpointExporter.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override protected void unexportService ( final ServiceReference<?> serviceReference ) { final Endpoint e; synchronized ( this ) { e = this.endpoints.remove ( serviceReference ); } if ( e != null ) { if ( e.isPublished () ) { try { e.stop (); } catch ( final Exception ex ) { logger.warn ( "Failed to stop export", ex ); } } } }
Example 3
Source File: SOAPLoggingTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testEvents() throws MalformedURLException { TestService serviceImpl = new TestServiceImplementation(); LoggingFeature loggingFeature = new LoggingFeature(); TestEventSender sender = new TestEventSender(); loggingFeature.setSender(sender); Endpoint ep = Endpoint.publish(SERVICE_URI, serviceImpl, loggingFeature); TestService client = createTestClient(loggingFeature); client.echo("test"); ep.stop(); List<LogEvent> events = sender.getEvents(); Assert.assertEquals(4, events.size()); checkRequestOut(events.get(0)); checkRequestIn(events.get(1)); checkResponseOut(events.get(2)); checkResponseIn(events.get(3)); }
Example 4
Source File: Main.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void run() { try { // Find vacant port number ServerSocket ss = new ServerSocket(0); port = ss.getLocalPort(); ss.close(); // Publish WebService System.out.println("Publishing WebService on " + port + " port"); Endpoint ep = Endpoint.publish("http://localhost:" + port + "/ws/hello", new HelloWorldImpl()); // Notify main thread that WS endpoint is published initSignal.countDown(); // Wait for main thread to complete testing System.out.println("Waiting for done signal from test client."); doneSignal.await(); // Terminate WS endpoint System.out.println("Got done signal from the client. Stopping WS endpoint."); ep.stop(); } catch (IOException ioe) { System.out.println("Failed to get vacant port number:" + ioe); } catch (InterruptedException ie) { System.out.println("Failed to wait for test completion:" + ie); } }
Example 5
Source File: JaxwsEndpointManager.java From cxf with Apache License 2.0 | 5 votes |
public void unregister(Endpoint endpoint, Object service) throws EndpointRegistrationException { try { if (mbeanServer != null && service instanceof AbstractEndpoint) { ObjectName on = ((AbstractEndpoint)service).getMBeanName(); if (on != null) { mbeanServer.unregisterMBean(on); } } } catch (Exception ex) { //ignore for now } endpoint.stop(); }
Example 6
Source File: WSTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void stop(Endpoint endPoint) { if (endPoint == null) return; try { endPoint.stop(); } catch (Throwable ignored) { } }
Example 7
Source File: WSTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void stop(Endpoint endPoint) { if (endPoint == null) return; try { endPoint.stop(); } catch (Throwable ignored) { } }
Example 8
Source File: Main.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void run() { try { // Find vacant port number ServerSocket ss = new ServerSocket(0); port = ss.getLocalPort(); ss.close(); // Publish WebService System.out.println("Publishing WebService on " + port + " port"); Endpoint ep = Endpoint.publish("http://localhost:" + port + "/ws/hello", new HelloWorldImpl()); // Notify main thread that WS endpoint is published initSignal.countDown(); // Wait for main thread to complete testing System.out.println("Waiting for done signal from test client."); doneSignal.await(); // Terminate WS endpoint System.out.println("Got done signal from the client. Stopping WS endpoint."); ep.stop(); } catch (IOException ioe) { System.out.println("Failed to get vacant port number:" + ioe); } catch (InterruptedException ie) { System.out.println("Failed to wait for test completion:" + ie); } }
Example 9
Source File: SOAPLoggingTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testSlf4j() throws MalformedURLException { TestService serviceImpl = new TestServiceImplementation(); LoggingFeature loggingFeature = new LoggingFeature(); loggingFeature.setPrettyLogging(true); // Setting the limit should omit parts of the body but the result should still be well formed xml loggingFeature.setLimit(140); Endpoint ep = Endpoint.publish(SERVICE_URI, serviceImpl, loggingFeature); TestService client = createTestClient(loggingFeature); client.echo("test"); ep.stop(); }
Example 10
Source File: Main.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void run() { try { // Find vacant port number ServerSocket ss = new ServerSocket(0); port = ss.getLocalPort(); ss.close(); // Publish WebService System.out.println("Publishing WebService on " + port + " port"); Endpoint ep = Endpoint.publish("http://localhost:" + port + "/ws/hello", new HelloWorldImpl()); // Notify main thread that WS endpoint is published initSignal.countDown(); // Wait for main thread to complete testing System.out.println("Waiting for done signal from test client."); doneSignal.await(); // Terminate WS endpoint System.out.println("Got done signal from the client. Stopping WS endpoint."); ep.stop(); } catch (IOException ioe) { System.out.println("Failed to get vacant port number:" + ioe); } catch (InterruptedException ie) { System.out.println("Failed to wait for test completion:" + ie); } }
Example 11
Source File: WSTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void stop(Endpoint endPoint) { if (endPoint == null) return; try { endPoint.stop(); } catch (Throwable ignored) { } }
Example 12
Source File: WSTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void stop(Endpoint endPoint) { if (endPoint == null) return; try { endPoint.stop(); } catch (Throwable ignored) { } }
Example 13
Source File: TestSuiteServer.java From cxf with Apache License 2.0 | 4 votes |
public void tearDown() { for (Endpoint ep : endpoints) { ep.stop(); } endpoints.clear(); }
Example 14
Source File: Server.java From cxf with Apache License 2.0 | 4 votes |
public void tearDown() { while (!eps.isEmpty()) { Endpoint ep = eps.remove(0); ep.stop(); } }
Example 15
Source File: ServerXMLBinding.java From cxf with Apache License 2.0 | 4 votes |
public void tearDown() { while (!eps.isEmpty()) { Endpoint ep = eps.remove(0); ep.stop(); } }
Example 16
Source File: EndpointAPITest.java From cxf with Apache License 2.0 | 4 votes |
@Test public void testSingleEndpoint() throws Exception { String contextPath = "/ctxt"; String path = "/echo"; String address = "http://localhost:" + currentPort + contextPath + path; HttpContext context = GrizzlyHttpContextFactory.createHttpContext(server, contextPath, path); Endpoint endpoint = Endpoint.create(new EndpointBean()); endpoint.publish(context); // Use grizzly HTTP context for publishing server.start(); invokeEndpoint(address); endpoint.stop(); }
Example 17
Source File: EndpointExporter.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override protected void exportService ( final ServiceReference<?> reference, final Object service ) { logger.info ( "Exporting service: {} -> {}", new Object[] { reference } ); Endpoint e = null; final ClassLoader currentClassLoader = Thread.currentThread ().getContextClassLoader (); try { Thread.currentThread ().setContextClassLoader ( service.getClass ().getClassLoader () ); final String[] clazzes = (String[])reference.getProperty ( Constants.OBJECTCLASS ); for ( final String clazzName : clazzes ) { final Class<?> clazz = reference.getBundle ().loadClass ( clazzName ); final WebService webService = clazz.getAnnotation ( WebService.class ); if ( webService != null ) { e = Endpoint.create ( service ); final String address = makeAddress ( reference, service, webService ); e.publish ( address ); e = this.endpoints.put ( reference, e ); if ( e != null ) { // we found a previous export ... stop the old one try { e.stop (); } catch ( final Throwable e2 ) { logger.warn ( "Failed to stop previous export", e2 ); } e = null; } } else { logger.warn ( "No webservice annotation found on {}", clazz ); } } } catch ( final Exception ex ) { logger.warn ( "Failed to export", ex ); } finally { Thread.currentThread ().setContextClassLoader ( currentClassLoader ); if ( e != null ) { e.stop (); } } }
Example 18
Source File: OASISCatalogTest.java From cxf with Apache License 2.0 | 4 votes |
/** * This is test case for https://issues.apache.org/jira/browse/CXF-6234 * * It's using paths that will be rewritten by following catalog rule: * * <rewriteSystem systemIdStartString="http://apache.org/hello_world/types2/" * rewritePrefix="/wsdl/others/"/> * */ @Test public void testWSDLPublishWithCatalogsRewritePaths() throws Exception { Endpoint ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", new GreeterImpl()); try { // schemas in the same directory as WSDL String result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema.xsd")); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema3.xsd")); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/d/hello_world_schema4.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/types2/hello_world_schema.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/types2/hello_world_schema3.xsd"); assertTrue(result.length() > 0); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/types2/d/hello_world_schema4.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/d/d/hello_world_schema4.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/types2/d/d/hello_world_schema4.xsd"); assertFalse(result.contains("schemaLocation")); // schemas in separate directory which is not subdirectory of WSDL dir result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "wsdl=http://apache.org/hello_world/types2/hello_world_messages_catalog.wsdl"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir/schema.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/schemas-in-separate-dir/schema.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/included.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/included.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/d/included.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/d/included.xsd"); assertFalse(result, result.contains("schemaLocation")); // rewrite rule that doesn't begin with 'classpath:' but contains only the path result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/another-schema.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/d/" + "another-included.xsd")); result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?" + "xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/d/another-included.xsd"); assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/d/d/" + "another-included.xsd")); } finally { ep.stop(); } }
Example 19
Source File: Server.java From cxf with Apache License 2.0 | 4 votes |
public void tearDown() { for (Endpoint ep : eps) { ep.stop(); } eps = null; }
Example 20
Source File: EmptySoapProviderServer.java From cxf with Apache License 2.0 | 4 votes |
public void tearDown() { while (!eps.isEmpty()) { Endpoint ep = eps.remove(0); ep.stop(); } }