List of usage examples for javax.xml.ws Endpoint stop
public abstract void stop();
From source file:se.vgregion.delegation.server.Server.java
public void stopServer(String port) { for (Endpoint endpoint : endpoints) { endpoint.stop(); }/*from ww w . ja v a 2 s .c om*/ endpoints = null; if (https) { engineFactory.destroyForPort(Integer.parseInt(port)); } LOGGER.info("Server shutdown!"); }
From source file:com.clustercontrol.plugin.impl.WebServicePlugin.java
@Override public void deactivate() { /**/*from ww w . ja v a 2 s . c o m*/ * web?? */ // ????? _threadPool.shutdown(); try { long _shutdownTimeout = HinemosPropertyUtil.getHinemosPropertyNum("ws.client.shutdown.timeout", Long.valueOf(10000)); if (!_threadPool.awaitTermination(_shutdownTimeout, TimeUnit.MILLISECONDS)) { List<Runnable> remained = _threadPool.shutdownNow(); if (remained != null) { log.info("shutdown timeout. runnable remained. (size = " + remained.size() + ")"); } } } catch (InterruptedException e) { _threadPool.shutdownNow(); } for (Endpoint endpoint : endpointList) { log.info("endpoint stop : " + endpoint.getImplementor().getClass().getSimpleName()); try { /** * JAX-WS?????0.0.0.0?listen???web? * stop?NullPointerException???stop??????? * http://java.net/jira/browse/JAX_WS-941 * * ?????JBoss?web????? * jboss.log????? */ endpoint.stop(); } catch (NullPointerException e) { log.info("stop endpoint : " + e.getMessage()); } catch (Exception e) { log.warn("stop endpoint : " + e.getMessage(), e); } } }
From source file:org.apache.juddi.v3.tck.UDDI_141_JIRAIntegrationTest.java
/** * testing upper case subscription callbacks * * @throws Exception/*from ww w . j a v a 2 s.c om*/ */ @Test public void JIRA_597() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JIRA_597"); int port = 7000; String hostname = TckPublisher.getProperties().getProperty("bindaddress"); if (hostname == null) { hostname = InetAddress.getLocalHost().getHostName(); } TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; Endpoint ep = null; boolean ok = false; do { try { logger.info("Attempting to bring up endpoint at " + "http://" + hostname + ":" + port + "/UDDI_CALLBACK"); ep = Endpoint.publish("http://" + hostname + ":" + port + "/UDDI_CALLBACK", impl); ok = true; } catch (Exception ex) { logger.warn("Trouble starting endpoint: " + ex.getMessage()); port++; } } while (!ok); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); be.getName().add(new Name()); be.getName().get(0).setValue("Joe's callback business"); be.setBusinessServices(new BusinessServices()); BusinessService bs = new BusinessService(); bs.getName().add(new Name()); bs.getName().get(0).setValue("Joe's callback service"); bs.setBindingTemplates(new BindingTemplates()); BindingTemplate bt = new BindingTemplate(); bt.setAccessPoint(new AccessPoint()); bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK"); bt.getAccessPoint().setUseType("endPoint"); //Added per Kurt TModelInstanceInfo instanceInfo = new TModelInstanceInfo(); instanceInfo.setTModelKey("uddi:uddi.org:transport:http"); bt.setTModelInstanceDetails(new TModelInstanceDetails()); bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo); bs.getBindingTemplates().getBindingTemplate().add(bt); bs.getBindingTemplates().getBindingTemplate().add(bt); be.getBusinessServices().getBusinessService().add(bs); sb.getBusinessEntity().add(be); BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); List<String> deleteme = new ArrayList<String>(); deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //ok Joe's callback is setup //Setup a business to subscribe to sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = new BusinessEntity(); be.getName().add(new Name()); be.getName().get(0).setValue("Sam's business"); sb.getBusinessEntity().add(be); BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb); //ok Joe now needs to subscribe for Sam's business Holder<List<Subscription>> list = new Holder<List<Subscription>>(); list.value = new ArrayList<Subscription>(); Subscription s = new Subscription(); s.setBindingKey(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0) .getBindingTemplates().getBindingTemplate().get(0).getBindingKey()); s.setSubscriptionFilter(new SubscriptionFilter()); s.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail()); s.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey() .add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); DatatypeFactory df = DatatypeFactory.newInstance(); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, 1); s.setExpiresAfter(df.newXMLGregorianCalendar(gcal)); s.setNotificationInterval(df.newDuration(5000)); list.value.add(s); subscriptionJoe.saveSubscription(authInfoJoe, list); //ok have sam change his business around. sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = saveBusiness1.getBusinessEntity().get(0); be.getName().get(0).setLang("en"); sb.getBusinessEntity().add(be); publicationSam.saveBusiness(sb); int maxwait = 30000; logger.info("waiting for callbacks"); while (maxwait > 0) { if (UDDISubscriptionListenerImpl.notifcationMap.size() > 0) { break; } Thread.sleep(1000); maxwait = maxwait - 1000; } TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); this.DeleteBusinesses(deleteme, authInfoJoe, publicationJoe); deleteme.clear(); deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); this.DeleteBusinesses(deleteme, authInfoSam, publicationSam); ep.stop(); if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) { Assert.fail("no callbacks were recieved."); } }
From source file:org.apache.juddi.v3.tck.UDDI_141_JIRAIntegrationTest.java
/** * testing callbacks with undefined transport type with a uppercase path * this also tests the case of one user subscribing to a specific entity * via GetBusinessDetail subscription filter * * @throws Exception/*www .ja v a 2s . c o m*/ */ @Test public void JIRA_596() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JIRA_596"); int port = 9000; String hostname = TckPublisher.getProperties().getProperty("bindaddress"); if (hostname == null) { hostname = InetAddress.getLocalHost().getHostName(); } // String localhostname = "localhost";//java.net.InetAddress.getLocalHost().getHostName(); TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); //UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl(); UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; Endpoint ep = null; boolean ok = false; do { try { ep = Endpoint.publish("http://" + hostname + ":" + port + "/UDDI_CALLBACK", impl); ok = true; } catch (Exception ex) { port++; } } while (!ok); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); be.getName().add(new Name()); be.getName().get(0).setValue("Joe's callback business"); be.setBusinessServices(new BusinessServices()); BusinessService bs = new BusinessService(); bs.getName().add(new Name()); bs.getName().get(0).setValue("Joe's callback service"); bs.setBindingTemplates(new BindingTemplates()); BindingTemplate bt = new BindingTemplate(); bt.setAccessPoint(new AccessPoint()); bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK"); bt.getAccessPoint().setUseType("endPoint"); //obmitted as part of the jira test case /*TModelInstanceInfo instanceInfo = new TModelInstanceInfo(); instanceInfo.setTModelKey("uddi:uddi.org:transport:http"); bt.setTModelInstanceDetails(new TModelInstanceDetails()); bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo); */ bs.getBindingTemplates().getBindingTemplate().add(bt); be.getBusinessServices().getBusinessService().add(bs); sb.getBusinessEntity().add(be); logger.info("setting up joe's callback business"); BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); List<String> deleteme = new ArrayList<String>(); deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey()); //ok Joe's callback is setup //Setup a business to subscribe to sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = new BusinessEntity(); be.getName().add(new Name()); be.getName().get(0).setValue("Sam's business"); sb.getBusinessEntity().add(be); logger.info("saving sam's business"); BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb); //ok Joe now needs to subscribe for Sam's business Holder<List<Subscription>> list = new Holder<List<Subscription>>(); list.value = new ArrayList<Subscription>(); Subscription s = new Subscription(); s.setBindingKey(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0) .getBindingTemplates().getBindingTemplate().get(0).getBindingKey()); s.setSubscriptionFilter(new SubscriptionFilter()); s.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail()); s.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey() .add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); DatatypeFactory df = DatatypeFactory.newInstance(); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, 1); s.setExpiresAfter(df.newXMLGregorianCalendar(gcal)); s.setNotificationInterval(df.newDuration(5000)); list.value.add(s); logger.info("subscribing joe's to updates for sam's business"); subscriptionJoe.saveSubscription(authInfoJoe, list); //ok have sam change his business around. sb = new SaveBusiness(); sb.setAuthInfo(authInfoSam); be = saveBusiness1.getBusinessEntity().get(0); be.getName().get(0).setLang("en"); sb.getBusinessEntity().add(be); logger.info("altering sam's business"); publicationSam.saveBusiness(sb); logger.info("Waiting..."); int maxwait = 30000; while (maxwait > 0) { if (UDDISubscriptionListenerImpl.notifcationMap.size() > 0) { break; } Thread.sleep(1000); maxwait = maxwait - 1000; } TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); DeleteBusinesses(deleteme, authInfoJoe, publicationJoe); deleteme.clear(); deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); DeleteBusinesses(deleteme, authInfoSam, publicationSam); ep.stop(); if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) { logger.error("no callbacks were recieved"); Assert.fail("no callbacks were recieved."); } logger.info("callback response was " + UDDISubscriptionListenerImpl.notifcationMap.get(0)); logger.info("PASS"); }
From source file:org.eclipse.smila.webservice.WebservicePublisher.java
/** * stop the service tracker, stop all published webservices, clean up. *//*from w w w .j a va 2s. c om*/ @Override public void close() { super.close(); for (final Endpoint endpoint : _endpoints.values()) { try { endpoint.stop(); } catch (final RuntimeException ex) { _log.warn("error while shutting down", ex); } } _endpoints.clear(); _references.clear(); }
From source file:org.eclipse.smila.webservice.WebservicePublisher.java
/** * stop a published webservice./* w ww.j a v a2 s . co m*/ * * @param reference * service reference for deactivated service. */ public void stopWebservice(final ServiceReference reference) { final String name = reference.getProperty(PROP_WEBSERVICENAME).toString(); final ServiceReference publishedRef = _references.get(name); if (reference.equals(publishedRef)) { try { final Endpoint ep = _endpoints.get(name); if (ep != null) { _log.debug("Stopping webservice " + name); ep.stop(); _endpoints.remove(name); _references.remove(name); _log.info("Webservice " + name + " successfully stopped."); } } catch (final Throwable ex) { _log.error("Error stopping webservice " + name, ex); } } else { _log.warn("Service reference for webservice " + name + " differs from removed reference, ignoring event."); } }
From source file:org.kie.remote.services.ws.command.CommandServiceTest.java
@AfterClass public static void tearDown() { for (Endpoint ep : eps) { try {//ww w .ja va 2 s . co m if (ep != null) { ep.stop(); } } catch (Throwable t) { t.printStackTrace(); System.out.println("Error thrown: " + t.getMessage()); } } }
From source file:org.nuxeo.ecm.platform.ws.WSEndpointManagerImpl.java
@Override public void deactivate(ComponentContext context) { super.deactivate(context); for (Endpoint ep : endpoints.values()) { ep.stop(); }/* w w w .ja v a2 s . co m*/ endpoints.clear(); }
From source file:org.nuxeo.ecm.platform.ws.WSEndpointManagerImpl.java
protected void stopIfExists(String name) { // Stop endpoint publishing Endpoint ep = endpoints.get(name); if (ep != null) { ep.stop(); endpoints.remove(name);/*from ww w . j a v a 2s . c o m*/ } }
From source file:ru.codeinside.gws.core.sproto.R120315_Metro_Test.java
@Test public void testRequestParsing() throws IOException { final URL addr = new URL("http://127.0.0.1:7771/"); final AtomicReference<ServerRequest> request = new AtomicReference<ServerRequest>(); Endpoint endpoint = Endpoint.publish("http://127.0.0.1:7771/", new Router(new Invoker() { @Override/*from www. j av a 2 s.com*/ public SOAPMessage invoke(SOAPMessage in, WebServiceContext ctx) { CryptoProvider cryptoProvider = mock(CryptoProvider.class); R120315 r120315 = new R120315(cryptoProvider); request.set(r120315.processRequest(in, mvvPort.service, mvvPort.portDef)); ServerResponse response = new ServerResponse(); response.action = new QName("http://mvv.oep.com/", "putData"); Packet p = new Packet(); response.packet = p; p.exchangeType = "Test"; p.serviceCode = "111111111111"; p.requestIdRef = "111111111111"; p.originRequestIdRef = "111111111111"; p.caseNumber = "111111111111"; p.typeCode = Packet.Type.SERVICE; p.status = Packet.Status.PROCESS; p.recipient = p.sender = new InfoSystem("PNZR01581", "111111111"); p.date = new Date(); return r120315.processResponse(null, response, mvvPort.service, mvvPort.portDef, null); } })); try { assertTrue(endpoint.isPublished()); HttpURLConnection con = (HttpURLConnection) addr.openConnection(); con.setRequestProperty("Content-type", "text/xml; charset=utf-8"); con.setDoOutput(true); con.setDoInput(true); IOUtils.copy(R.getRequiredResourceStream("mvvact/putData/request.xml"), con.getOutputStream()); String result = IOUtils.toString(con.getInputStream(), "UTF8"); assertNotNull(result); ServerRequest req = request.get(); assertNull(req.routerPacket); assertEquals(new QName("http://mvv.oep.com/", "putData"), req.action); assertEquals("UniversalMVV", req.packet.serviceName); assertEquals(Packet.Type.SERVICE, req.packet.typeCode); assertEquals(Packet.Status.REQUEST, req.packet.status); assertEquals("Test", req.packet.exchangeType); assertEquals("111111111111", req.packet.requestIdRef); assertEquals("111111111111", req.packet.originRequestIdRef); assertEquals("111111111111", req.packet.serviceCode); assertEquals("111111111111", req.packet.caseNumber); assertNull(req.attachmens); assertNull(req.docRequestCode); } finally { endpoint.stop(); } }