javax.xml.ws.Endpoint Java Examples
The following examples show how to use
javax.xml.ws.Endpoint.
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: StaxServer.java From cxf with Apache License 2.0 | 7 votes |
private void doPublish(String url, Object obj) { Endpoint ep = Endpoint.create(obj); ep.getProperties().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true"); ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER + ".sct", new KeystorePasswordCallback()); ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", "bob.properties"); if (url.contains("X10_I")) { ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct", "bob.properties"); ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", "alice.properties"); } else if (url.contains("MutualCert")) { ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", "bob.properties"); ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct", "alice.properties"); ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback()); } else if (url.contains("UserNameOverTransport")) { ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER + ".sct", new UTPasswordCallback()); } ep.publish(url); }
Example #2
Source File: SSLNettyServerTest.java From cxf with Apache License 2.0 | 6 votes |
@BeforeClass public static void start() throws Exception { Bus b = createStaticBus("/org/apache/cxf/transport/http/netty/server/integration/ServerConfig.xml"); // setup the ssl interceptor MySSLInterceptor myInterceptor = new MySSLInterceptor(); b.getInInterceptors().add(myInterceptor); BusFactory.setThreadDefaultBus(b); address = "https://localhost:" + PORT + "/SoapContext/SoapPort"; ep = Endpoint.publish(address, new org.apache.hello_world_soap_http.GreeterImpl()); URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl"); assertNotNull("WSDL is null", wsdl); SOAPService service = new SOAPService(wsdl); assertNotNull("Service is null", service); g = service.getSoapPort(); assertNotNull("Port is null", g); }
Example #3
Source File: ClientServiceConfigTest.java From cxf with Apache License 2.0 | 6 votes |
@Before public void before() throws Exception { super.setUp(); ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean(); factory.setInvoker(new BeanInvoker(new EchoImpl())); factory.setDataBinding(new AegisDatabinding()); ServerFactoryBean svrFac = new ServerFactoryBean(); svrFac.setAddress("local://Echo"); svrFac.setServiceFactory(factory); svrFac.setServiceClass(Echo.class); svrFac.setBus(getBus()); svrFac.create(); Endpoint endpoint = Endpoint.create(new EchoImpl()); impl = (EndpointImpl) endpoint; impl.setDataBinding(new AegisDatabinding()); endpoint.publish("local://JaxWsEcho"); }
Example #4
Source File: EndpointExporter.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public void dispose () { super.dispose (); List<Endpoint> endpoints; synchronized ( this ) { endpoints = new ArrayList<Endpoint> ( this.endpoints.values () ); this.endpoints.clear (); } for ( final Endpoint e : endpoints ) { e.stop (); } }
Example #5
Source File: WSTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); Endpoint endPoint1 = null; Endpoint endPoint2 = null; try { endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1", new Method1()); endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2", new Method2()); System.out.println("Sleep 3 secs..."); Thread.sleep(3000); } finally { stop(endPoint2); stop(endPoint1); } }
Example #6
Source File: DispatchClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { setBus(BusFactory.getDefaultBus()); Object implementor = new GreeterImpl(); String address = "http://localhost:" + TestUtil.getPortNumber(DispatchClientServerTest.class) + "/SOAPDispatchService/SoapDispatchPort"; ep = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, implementor); Map<String, Object> properties = new HashMap<>(); Map<String, String> nsMap = new HashMap<>(); nsMap.put("gmns", "http://apache.org/hello_world_soap_http/types"); properties.put("soap.env.ns.map", nsMap); properties.put("disable.outputstream.optimization", "true"); ep.setProperties(properties); ep.publish(address); BusFactory.setDefaultBus(null); BusFactory.setThreadDefaultBus(null); }
Example #7
Source File: ExtSoapHeaderClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { String address0 = "http://localhost:" + PORT0 + "/SoapExtHeader/SampleService"; Object implementor1 = new SamplePortTypeImpl(); Endpoint.publish(address0, implementor1); String address1 = "http://localhost:" + PORT1 + "/SoapExtHeader/SampleService"; JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass(SamplePortTypeImpl.class); WebServiceClient webService = SampleService.class.getAnnotation(WebServiceClient.class); sf.setServiceName(new QName(webService.targetNamespace(), webService.name())); sf.setWsdlLocation(webService.wsdlLocation()); sf.setAddress(address1); extserver = sf.create(); }
Example #8
Source File: AddressingPolicyTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { System.setProperty("temp.location", tmpDir); SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr.xml"); BusFactory.setDefaultBus(bus); setBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); bus.getInFaultInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.publish(address, implementor); LOG.info("Published greeter endpoint."); }
Example #9
Source File: AbstractColocTest.java From cxf with Apache License 2.0 | 6 votes |
/** * Setup this test case */ @Before public void setUp() throws Exception { // initialize Mule Manager URL cxfConfig = null; if (getCxfConfig() != null) { cxfConfig = ClassLoaderUtils.getResource(getCxfConfig(), AbstractColocTest.class); if (cxfConfig == null) { throw new Exception("Make sure " + getCxfConfig() + " is in the CLASSPATH"); } assertNotNull(cxfConfig.toExternalForm()); } //Bus is shared by client, router and server. SpringBusFactory bf = new SpringBusFactory(); bus = bf.createBus(cxfConfig); BusFactory.setDefaultBus(bus); //Start the Remote Server // the endpoint of the "real" cxf server endpoint = Endpoint.publish(getTransportURI(), getServiceImpl()); }
Example #10
Source File: WSNHelper.java From cxf with Apache License 2.0 | 6 votes |
public Endpoint publish(String address, Object o, Class<?> ... extraClasses) { if (extraClasses != null && extraClasses.length > 0) { throw new UnsupportedOperationException("Pure JAX-WS does not support the extraClasses"); } Endpoint endpoint = Endpoint.create(o); URL wsdlLocation = WSNWSDLLocator.getWSDLUrl(); if (wsdlLocation != null) { try { if (endpoint.getProperties() == null) { endpoint.setProperties(new HashMap<String, Object>()); } endpoint.getProperties().put("javax.xml.ws.wsdl.description", wsdlLocation.toExternalForm()); List<Source> mt = new ArrayList<>(); StreamSource src = new StreamSource(wsdlLocation.openStream(), wsdlLocation.toExternalForm()); mt.add(src); endpoint.setMetadata(mt); } catch (IOException e) { //ignore, no wsdl really needed } } endpoint.publish(address); return endpoint; }
Example #11
Source File: ClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testProxy() throws Exception { InvocationHandler handler = new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return null; } }; Object implementor4 = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[] {DocLitWrappedCodeFirstService.class}, handler); Endpoint.publish("http://localhost:" + PUB_PORT + "/DocLitWrappedCodeFirstService/", implementor4); URL url = new URL("http://localhost:" + PUB_PORT + "/DocLitWrappedCodeFirstService/?wsdl"); InputStream ins = url.openStream(); ins.close(); }
Example #12
Source File: ServerXMLBinding.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { Object implementor = new GreeterImpl(); String address = "http://localhost:" + REG_PORT + "/XMLService/XMLPort"; eps.add(Endpoint.publish(address, implementor)); Object implementor1 = new org.apache.hello_world_xml_http.wrapped.GreeterImpl(); address = "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort"; eps.add(Endpoint.publish(address, implementor1)); Object faultImplementor = new GreeterFaultImpl(); String faultAddress = "http://localhost:" + REG_PORT + "/XMLService/XMLFaultPort"; eps.add(Endpoint.publish(faultAddress, faultImplementor)); Object implementor2 = new HeaderTesterImpl(); address = "http://localhost:" + REG_PORT + "/XMLContext/XMLPort"; eps.add(Endpoint.publish(address, implementor2)); Object implementor3 = new org.apache.hello_world_xml_http.mixed.GreeterImpl(); address = "http://localhost:" + MIX_PORT + "/XMLService/XMLPort"; eps.add(Endpoint.publish(address, implementor3)); }
Example #13
Source File: RobustServiceAtMostOnceTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { SpringBusFactory bf = new SpringBusFactory(); // use a at-most-once server with sync ack processing Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/atmostonce.xml"); BusFactory.setDefaultBus(bus); setBus(bus); bus.getExtension(RMManager.class).getConfiguration().setAcknowledgementInterval(Long.valueOf(0)); // add some intentional processing delay at inbound SlowProcessingSimulator sps = new SlowProcessingSimulator(); sps.setAction("http://cxf.apache.org/greeter_control/Greeter/greetMeOneWayRequest"); sps.setDelay(10000L); bus.getInInterceptors().add(sps); serverGreeter = new GreeterCounterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; // publish this robust oneway endpoint ep = Endpoint.create(serverGreeter); ep.getProperties().put(Message.ROBUST_ONEWAY, Boolean.TRUE); ep.publish(address); LOG.info("Published greeter endpoint."); }
Example #14
Source File: CachedOutMessageTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/message-loss.xml"); BusFactory.setDefaultBus(bus); setBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); bus.getInFaultInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.create(implementor); ep.publish(address); LOG.info("Published greeter endpoint."); }
Example #15
Source File: AddressingAnonymousPolicyTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { System.setProperty("server.temp.location", tmpDir); SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-anon-server.xml"); setBus(bus); BusFactory.setDefaultBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); bus.getInFaultInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.publish(address, implementor); LOG.info("Published greeter endpoint."); }
Example #16
Source File: DecoupledClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/decoupled.xml"); BusFactory.setDefaultBus(bus); setBus(bus); LoggingInInterceptor in = new LoggingInInterceptor(); bus.getInInterceptors().add(in); bus.getInFaultInterceptors().add(in); LoggingOutInterceptor out = new LoggingOutInterceptor(); bus.getOutInterceptors().add(out); bus.getOutFaultInterceptors().add(out); GreeterImpl implementor = new GreeterImpl(); implementor.useLastOnewayArg(true); implementor.setDelay(5000); String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort"; ep = Endpoint.create(implementor); Map<String, Object> properties = new HashMap<>(); properties.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE); ep.setProperties(properties); ep.publish(address); LOG.info("Published greeter endpoint."); }
Example #17
Source File: EndpointAPITest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testMultipleEndpointsSameContext() throws Exception { server.start(); String contextPath = "/ctxt"; String path = "/echo"; int k = 3; Endpoint[] endpoints = new Endpoint[k]; HttpContext[] contexts = new HttpContext[k]; String[] addresses = new String[k]; for (int i = 0; i < k; i++) { addresses[i] = "http://localhost:" + currentPort + contextPath + path + i; contexts[i] = GrizzlyHttpContextFactory.createHttpContext(server, contextPath, path + i); endpoints[i] = Endpoint.create(new EndpointBean()); endpoints[i].publish(contexts[i]); } for (int i = 0; i < k; i++) { invokeEndpoint(addresses[i]); } for (int i = 0; i < k; i++) { endpoints[i].stop(); } }
Example #18
Source File: Server.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { System.setProperty("org.apache.cxf.bus.factory", "org.apache.cxf.bus.CXFBusFactory"); Object implementor = new PutLastTradedPriceImpl(); String address = "http://localhost:" + PORT + "/SOAPDocLitBareService/SoapPort"; ep = Endpoint.create(implementor); Map<String, Object> props = new HashMap<>(2); props.put(Endpoint.WSDL_SERVICE, new QName("http://apache.org/hello_world_doc_lit_bare", "SOAPService")); props.put(Endpoint.WSDL_PORT, new QName("http://apache.org/hello_world_doc_lit_bare", "SoapPort")); ep.setProperties(props); ep.publish(address); implementor = new BareSoapServiceImpl(); address = "http://localhost:" + PORT + "/SOAPDocLitBareService/SoapPort1"; ep = Endpoint.create(implementor); ep.publish(address); }
Example #19
Source File: AbstractClientPersistenceTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { SpringBusFactory bf = new SpringBusFactory(); System.setProperty("db.name", pfx + "-server"); Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/persistent.xml"); BusFactory.setDefaultBus(bus); setBus(bus); System.clearProperty("db.name"); LoggingInInterceptor logIn = new LoggingInInterceptor(); bus.getInInterceptors().add(logIn); LoggingOutInterceptor logOut = new LoggingOutInterceptor(); bus.getOutFaultInterceptors().add(logOut); bus.getOutFaultInterceptors().add(logOut); bus.getExtension(RMManager.class).getConfiguration() .setBaseRetransmissionInterval(Long.valueOf(60000)); GreeterImpl implementor = new GreeterImpl(); String address = "http://localhost:" + port + "/SoapContext/GreeterPort"; ep = Endpoint.create(implementor); Map<String, Object> properties = new HashMap<>(); properties.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE); ep.setProperties(properties); ep.publish(address); LOG.info("Published greeter endpoint."); }
Example #20
Source File: WSTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); Endpoint endPoint1 = null; Endpoint endPoint2 = null; try { endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1", new Method1()); endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2", new Method2()); System.out.println("Sleep 3 secs..."); Thread.sleep(3000); } finally { stop(endPoint2); stop(endPoint1); } }
Example #21
Source File: EndpointAPITest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testMultipleEndpointsDifferentContexts() throws Exception { server.start(); String contextPath = "/ctxt"; String path = "/echo"; int k = 3; Endpoint[] endpoints = new Endpoint[k]; HttpContext[] contexts = new HttpContext[k]; String[] addresses = new String[k]; for (int i = 0; i < k; i++) { addresses[i] = "http://localhost:" + currentPort + contextPath + i + path; contexts[i] = GrizzlyHttpContextFactory.createHttpContext(server, contextPath + i, path); endpoints[i] = Endpoint.create(new EndpointBean()); endpoints[i].publish(contexts[i]); } for (int i = 0; i < k; i++) { invokeEndpoint(addresses[i]); } for (int i = 0; i < k; i++) { endpoints[i].stop(); } }
Example #22
Source File: WSTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { // find a free port ServerSocket ss = new ServerSocket(0); int port = ss.getLocalPort(); ss.close(); Endpoint endPoint1 = null; Endpoint endPoint2 = null; try { endPoint1 = Endpoint.publish("http://0.0.0.0:" + port + "/method1", new Method1()); endPoint2 = Endpoint.publish("http://0.0.0.0:" + port + "/method2", new Method2()); System.out.println("Sleep 3 secs..."); Thread.sleep(3000); } finally { stop(endPoint2); stop(endPoint1); } }
Example #23
Source File: RunWebService.java From ignite-book-code-samples with GNU General Public License v3.0 | 5 votes |
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-core.xml"); WebServices services = (WebServices) ctx.getBean("servicesBean"); Endpoint.publish("http://localhost:7001/invokeRules", services); System.out.println("Server start in Port .. 7001"); }
Example #24
Source File: SimpleJaxWsServiceExporter.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Calculate the full endpoint address for the given endpoint. * @param endpoint the JAX-WS Provider Endpoint object * @param serviceName the given service name * @return the full endpoint address */ protected String calculateEndpointAddress(Endpoint endpoint, String serviceName) { String fullAddress = this.baseAddress + serviceName; if (endpoint.getClass().getName().startsWith("weblogic.")) { // Workaround for WebLogic 10.3 fullAddress = fullAddress + "/"; } return fullAddress; }
Example #25
Source File: CustomerServiceServer.java From cxf with Apache License 2.0 | 5 votes |
protected CustomerServiceServer() throws Exception { System.out.println("Starting Server"); CustomerService implementor = new CustomerServiceImpl(); Endpoint.publish("http://localhost:9090/CustomerServicePort", implementor, new LoggingFeature()); }
Example #26
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected Server() throws Exception { System.out.println("Starting Server"); Object implementor = new GreeterJMSImpl(); ep = Endpoint.publish(null, implementor, new LoggingFeature()); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { shutdown(); } }); }
Example #27
Source File: SonosConfiguration.java From airsonic-advanced with GNU General Public License v3.0 | 5 votes |
@Bean public Endpoint sonosEndpoint(Bus bus, SonosService sonosService, SonosFaultInterceptor sonosFaultInterceptor, SonosLinkSecurityInterceptor sonosSecurity) { EndpointImpl endpoint = new EndpointImpl(bus, sonosService); endpoint.setOutFaultInterceptors(Collections.singletonList(sonosFaultInterceptor)); endpoint.setInInterceptors(Collections.singletonList(sonosSecurity)); endpoint.publish("/Sonos"); return endpoint; }
Example #28
Source File: AbstractJaxWsServiceExporter.java From java-technology-stack with MIT License | 5 votes |
/** * Stops all published endpoints, taking the web services offline. */ @Override public void destroy() { for (Endpoint endpoint : this.publishedEndpoints) { endpoint.stop(); } }
Example #29
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 #30
Source File: DecoupledBareTest.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus("/org/apache/cxf/systest/ws/rm/decoupled_bare.xml"); BusFactory.setDefaultBus(bus); setBus(bus); Object implementor = new DocLitBareGreeterImpl(); String address = "http://localhost:" + PORT + "/SoapContext/SoapPort"; ep = Endpoint.create(implementor); Map<String, Object> properties = new HashMap<>(); properties.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE); ep.setProperties(properties); ep.publish(address); LOG.info("Published server endpoint."); }