org.apache.cxf.jaxws.EndpointImpl Java Examples
The following examples show how to use
org.apache.cxf.jaxws.EndpointImpl.
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: ProviderTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testInvocation() throws Exception { try (EndpointImpl ep = new EndpointImpl(getBus(), new PayloadProvider(), (String) null)) { ep.publish("local://localhost:9000/Provider"); Node response = invoke("local://localhost:9000/Provider", LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml"); assertNotNull(response); assertNoFault(response); addNamespace("j", "http://service.jaxws.cxf.apache.org/"); assertValid("//s:Body/j:sayHi", response); } }
Example #2
Source File: ClientMtomXopWithJMSTest.java From cxf with Apache License 2.0 | 6 votes |
@BeforeClass public static void startServers() throws Exception { Object implementor = new TestMtomJMSImpl(); bus = BusFactory.getDefaultBus(); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); PooledConnectionFactory cfp = new PooledConnectionFactory(cf); cff = new ConnectionFactoryFeature(cfp); EndpointImpl ep = (EndpointImpl)Endpoint.create(implementor); ep.getFeatures().add(cff); ep.getInInterceptors().add(new TestMultipartMessageInterceptor()); ep.getOutInterceptors().add(new TestAttachmentOutInterceptor()); //ep.getInInterceptors().add(new LoggingInInterceptor()); //ep.getOutInterceptors().add(new LoggingOutInterceptor()); SOAPBinding jaxWsSoapBinding = (SOAPBinding)ep.getBinding(); jaxWsSoapBinding.setMTOMEnabled(true); ep.publish(); }
Example #3
Source File: Server.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { Object implementor; String address; implementor = new GreeterImpl(); address = "ws://localhost:" + PORT + "/SoapContext/SoapPort"; Endpoint ep = Endpoint.publish(address, implementor); eps.add(ep); //publish port with soap12 binding address = "ws://localhost:" + PORT + "/SoapContext/SoapPort"; EndpointImpl e = (EndpointImpl) Endpoint.create(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING, new Greeter12Impl()); e.publish(address); eps.add(e); }
Example #4
Source File: Server.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { setBus(BusFactory.getDefaultBus()); getBus().getInInterceptors().add(new LoggingInInterceptor()); String address = "http://localhost:" + PORT + "/SoapContext/SoapPort"; Object implementor1 = new GreeterImplMixedStyle(" version1"); EndpointImpl ep1 = (EndpointImpl) Endpoint.publish(address, implementor1); ep1.getServer().getEndpoint().put("version", "1"); ep1.getServer().getEndpoint().put("allow-multiplex-endpoint", Boolean.TRUE); //Register a MediatorInInterceptor on this dummy service Object implementor2 = new GreeterImplMixedStyle(" version2"); EndpointImpl ep2 = (EndpointImpl) Endpoint.publish(address, implementor2); ep2.getServer().getEndpoint().put("version", "2"); MultipleEndpointObserver meo = (MultipleEndpointObserver) ep1.getServer().getDestination().getMessageObserver(); meo.getRoutingInterceptors().clear(); meo.getRoutingInterceptors().add(new MediatorInInterceptor()); }
Example #5
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 #6
Source File: ClientMtomXopTest.java From cxf with Apache License 2.0 | 6 votes |
protected void run() { Object implementor = new TestMtomImpl(); String address = "http://localhost:" + PORT + "/mime-test"; String addressProvider = "http://localhost:" + PORT + "/mime-test-provider"; try { jaxep = (EndpointImpl) javax.xml.ws.Endpoint.publish(address, implementor); Endpoint ep = jaxep.getServer().getEndpoint(); ep.getInInterceptors().add(new TestMultipartMessageInterceptor()); ep.getOutInterceptors().add(new TestAttachmentOutInterceptor()); jaxep.getInInterceptors().add(new LoggingInInterceptor()); jaxep.getOutInterceptors().add(new LoggingOutInterceptor()); SOAPBinding jaxWsSoapBinding = (SOAPBinding) jaxep.getBinding(); jaxep.getProperties().put("schema-validation-enabled", "true"); jaxWsSoapBinding.setMTOMEnabled(true); EndpointImpl endpoint = (EndpointImpl)javax.xml.ws.Endpoint.publish(addressProvider, new TestMtomProviderImpl()); endpoint.getProperties().put("schema-validation-enabled", "true"); endpoint.getInInterceptors().add(new LoggingInInterceptor()); endpoint.getOutInterceptors().add(new LoggingOutInterceptor()); } catch (Exception e) { Thread.currentThread().interrupt(); } }
Example #7
Source File: EndpointDefinitionParser.java From cxf with Apache License 2.0 | 6 votes |
public static final void setBlocking(ApplicationContext ctx, EndpointImpl impl) { AutowireCapableBeanFactory fact = ctx.getAutowireCapableBeanFactory(); if (fact instanceof DefaultListableBeanFactory) { DefaultListableBeanFactory dlbf = (DefaultListableBeanFactory)fact; for (BeanPostProcessor bpp : dlbf.getBeanPostProcessors()) { if (CommonAnnotationBeanPostProcessor.class.isInstance(bpp)) { impl.getServerFactory().setBlockPostConstruct(true); impl.getServerFactory().setBlockInjection(false); return; } if (bpp instanceof Jsr250BeanPostProcessor) { impl.getServerFactory().setBlockInjection(true); } } } }
Example #8
Source File: ProviderImpl.java From cxf with Apache License 2.0 | 6 votes |
public Endpoint createEndpoint(String bindingId, Class<?> implementorClass, Invoker invoker, WebServiceFeature ... features) { if (EndpointUtils.isValidImplementor(implementorClass)) { Bus bus = BusFactory.getThreadDefaultBus(); JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); if (features != null) { factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features)); } if (invoker != null) { factory.setInvoker(new JAXWSMethodInvoker(invoker)); try { invoker.inject(new WebServiceContextImpl()); } catch (Exception e) { throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG", LOG).toString(), e); } } EndpointImpl ep = new EndpointImpl(bus, null, factory); ep.setImplementorClass(implementorClass); return ep; } throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); }
Example #9
Source File: ProviderTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testCXF1852() throws Exception { try (EndpointImpl ep = new EndpointImpl(getBus(), new PayloadProvider2(), (String) null)) { ep.publish("local://localhost:9001/Provider2"); Node response = invoke("local://localhost:9001/Provider2", LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml"); assertNotNull(response); assertNoFault(response); addNamespace("j", "http://service.jaxws.cxf.apache.org/"); assertValid("//s:Body/j:sayHi", response); } }
Example #10
Source File: StaxServer.java From cxf with Apache License 2.0 | 6 votes |
protected StaxServer() throws Exception { System.out.println("Starting StaxServer"); Object implementor = new GreeterImpl(); String address = "http://localhost:9000/SoapContext/GreeterPort"; EndpointImpl impl = (EndpointImpl)Endpoint.publish(address, implementor); WSSSecurityProperties properties = new WSSSecurityProperties(); properties.addAction(WSSConstants.USERNAMETOKEN); properties.addAction(WSSConstants.TIMESTAMP); properties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT); properties.setTokenUser("Alice"); properties.setCallbackHandler(new UTPasswordCallback()); impl.getOutInterceptors().add(new WSS4JStaxOutInterceptor(properties)); WSSSecurityProperties inProperties = new WSSSecurityProperties(); inProperties.addAction(WSSConstants.USERNAMETOKEN); inProperties.addAction(WSSConstants.TIMESTAMP); inProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST); inProperties.setCallbackHandler(new UTPasswordCallback()); impl.getInInterceptors().add(new WSS4JStaxInInterceptor(inProperties)); }
Example #11
Source File: Server.java From cxf with Apache License 2.0 | 6 votes |
protected Server() throws Exception { System.out.println("Starting Server"); Object implementor = new GreeterImpl(); String address = "http://localhost:9000/SoapContext/GreeterPort"; EndpointImpl impl = (EndpointImpl)Endpoint.publish(address, implementor); Map<String, Object> outProps = new HashMap<>(); outProps.put("action", "UsernameToken Timestamp"); outProps.put("passwordType", "PasswordText"); outProps.put("user", "Alice"); outProps.put("passwordCallbackClass", "demo.wssec.server.UTPasswordCallback"); impl.getOutInterceptors().add(new WSS4JOutInterceptor(outProps)); Map<String, Object> inProps = new HashMap<>(); inProps.put("action", "UsernameToken Timestamp"); inProps.put("passwordType", "PasswordDigest"); inProps.put("passwordCallbackClass", "demo.wssec.server.UTPasswordCallback"); impl.getInInterceptors().add(new WSS4JInInterceptor(inProps)); }
Example #12
Source File: NamespaceUriProviderBean.java From iaf with Apache License 2.0 | 6 votes |
@Override public void afterPropertiesSet() throws Exception { //TODO look into NamespaceHandlerResolver Bus bus = (Bus) applicationContext.getBean("cxf"); if(bus instanceof SpringBus) { log.debug("default CXF SpringBus ["+bus.getId()+"]"); log.info("registering NamespaceURI Provider with JAX-WS CXF Dispatcher"); namespaceRouter = new EndpointImpl(bus, new NamespaceUriProvider()); namespaceRouter.publish("/rpcrouter"); if(namespaceRouter.isPublished()) { log.info("published NamespaceURI Provider on CXF endpoint [rpcrouter] on SpringBus ["+namespaceRouter.getBus().getId()+"]"); } else { throw new IllegalStateException("unable to NamespaceURI Service Provider on CXF endpoint [rpcrouter]"); } } else { throw new IllegalStateException("CXF bus ["+bus+"] not instance of [SpringBus]"); } }
Example #13
Source File: IbisApplicationInitializer.java From iaf with Apache License 2.0 | 6 votes |
@Override protected WebApplicationContext createWebApplicationContext(ServletContext servletContext) { System.setProperty(EndpointImpl.CHECK_PUBLISH_ENDPOINT_PERMISSON_PROPERTY_WITH_SECURITY_MANAGER, "false"); servletContext.log("Starting IBIS WebApplicationInitializer"); XmlWebApplicationContext applicationContext = new XmlWebApplicationContext(); applicationContext.setConfigLocation(XmlWebApplicationContext.CLASSPATH_URL_PREFIX + "/webApplicationContext.xml"); applicationContext.setDisplayName("IbisApplicationInitializer"); MutablePropertySources propertySources = applicationContext.getEnvironment().getPropertySources(); propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); propertySources.remove(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); propertySources.addFirst(new PropertiesPropertySource("ibis", AppConstants.getInstance())); return applicationContext; }
Example #14
Source File: WebServiceListener.java From iaf with Apache License 2.0 | 5 votes |
@Override public void open() throws ListenerException { if (StringUtils.isNotEmpty(getAddress())) { Bus cxfBus = BusFactory.getDefaultBus(false); if(cxfBus == null) { throw new ListenerException("unable to find SpringBus"); } log.debug("registering listener ["+getName()+"] with JAX-WS CXF Dispatcher on SpringBus ["+cxfBus.getId()+"]"); endpoint = new EndpointImpl(cxfBus, new MessageProvider(this, getMultipartXmlSessionKey())); endpoint.publish("/"+getAddress()); SOAPBinding binding = (SOAPBinding)endpoint.getBinding(); binding.setMTOMEnabled(isMtomEnabled()); if(endpoint.isPublished()) { log.debug("published listener ["+getName()+"] on CXF endpoint ["+getAddress()+"]"); } else { log.error("unable to publish listener ["+getName()+"] on CXF endpoint ["+getAddress()+"]"); } } //Can bind on multiple endpoints if (StringUtils.isNotEmpty(getServiceNamespaceURI())) { log.debug("registering listener ["+getName()+"] with ServiceDispatcher by serviceNamespaceURI ["+getServiceNamespaceURI()+"]"); ServiceDispatcher.getInstance().registerServiceClient(getServiceNamespaceURI(), this); } else { log.debug("registering listener ["+getName()+"] with ServiceDispatcher"); ServiceDispatcher.getInstance().registerServiceClient(getName(), this); //Backwards compatibility } super.open(); }
Example #15
Source File: ProviderImpl.java From cxf with Apache License 2.0 | 5 votes |
public Endpoint createEndpoint(String bindingId, Object implementor, WebServiceFeature ... features) { EndpointImpl ep = null; if (EndpointUtils.isValidImplementor(implementor)) { Bus bus = BusFactory.getThreadDefaultBus(); ep = createEndpointImpl(bus, bindingId, implementor, features); return ep; } throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); }
Example #16
Source File: HeaderClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { BusFactory.setDefaultBus(getBus()); Object implementor = new TestHeaderImpl(); String address = "http://localhost:9104/SoapHeaderContext/SoapHeaderPort"; endpoint = (EndpointImpl) Endpoint.publish(address, implementor); implementor = new TestRPCHeaderImpl(); address = "http://localhost:9104/SoapHeaderRPCContext/SoapHeaderRPCPort"; rpcEndpoint = (EndpointImpl)Endpoint.publish(address, implementor); }
Example #17
Source File: SoapJmsSpecTest.java From cxf with Apache License 2.0 | 5 votes |
@BeforeClass public static void startServers() throws Exception { startBusAndJMS(SoapJmsSpecTest.class); publish("jms:queue:test.cxf.jmstransport.queue2", new GreeterSpecImpl()); publish("jms:queue:test.cxf.jmstransport.queue5", new GreeterSpecWithPortError()); EndpointImpl ep = (EndpointImpl)Endpoint.create(null, new GreeterSpecImpl()); ep.setBus(bus); ep.getFeatures().add(new GZIPFeature()); ep.getFeatures().add(cff); ep.publish("jms:queue:test.cxf.jmstransport.queue6"); }
Example #18
Source File: EndpointDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
@Override protected String resolveId(Element elem, AbstractBeanDefinition definition, ParserContext ctx) throws BeanDefinitionStoreException { String id = super.resolveId(elem, definition, ctx); if (StringUtils.isEmpty(id)) { id = EndpointImpl.class.getName() + "--" + definition.hashCode(); } return id; }
Example #19
Source File: ProviderJMSContinuationTest.java From cxf with Apache License 2.0 | 5 votes |
@BeforeClass public static void startServers() throws Exception { startBusAndJMS(ProviderJMSContinuationTest.class); Object implementor = new HWSoapMessageDocProvider(); String address = "jms:queue:test.jmstransport.text?replyToQueueName=test.jmstransport.text.reply"; EndpointImpl ep = (EndpointImpl)Endpoint.create(implementor); ep.getInInterceptors().add(new IncomingMessageCounterInterceptor()); ep.setBus(bus); ep.getFeatures().add(cff); ep.publish(address); }
Example #20
Source File: JMSTestMtom.java From cxf with Apache License 2.0 | 5 votes |
@BeforeClass public static void startServers() throws Exception { broker = new EmbeddedJMSBrokerLauncher(); broker.startInProcess(); bus = BusFactory.getDefaultBus(); broker.updateWsdl(bus, "testutils/jms_test_mtom.wsdl"); Object mtom = new JMSMTOMImpl(); EndpointImpl ep = (EndpointImpl)Endpoint .publish("jms:jndi:dynamicQueues/test.cxf.jmstransport.queue&receiveTimeout=10000", mtom); Binding binding = ep.getBinding(); ((SOAPBinding)binding).setMTOMEnabled(true); }
Example #21
Source File: MultiTransportClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
@BeforeClass public static void startServers() throws Exception { bus = BusFactory.getDefaultBus(); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); PooledConnectionFactory cfp = new PooledConnectionFactory(cf); cff = new ConnectionFactoryFeature(cfp); String address = "http://localhost:" + PORT + "/SOAPDocLitService/SoapPort"; Endpoint.publish(address, new HTTPGreeterImpl()); EndpointImpl ep1 = (EndpointImpl)Endpoint.create(new JMSGreeterImpl()); ep1.setBus(bus); ep1.getFeatures().add(cff); ep1.publish(); }
Example #22
Source File: WSDiscoveryServiceImpl.java From cxf with Apache License 2.0 | 5 votes |
public synchronized boolean startup(boolean optional) { String preferIPv4StackValue = System.getProperty("java.net.preferIPv4Stack"); String preferIPv6AddressesValue = System.getProperty("java.net.preferIPv6Addresses"); if (!started && client.isAdHoc()) { Bus b = BusFactory.getAndSetThreadDefaultBus(bus); try { udpEndpoint = new EndpointImpl(bus, new WSDiscoveryProvider()); Map<String, Object> props = new HashMap<>(); props.put("jaxws.provider.interpretNullAsOneway", "true"); udpEndpoint.setProperties(props); if ("true".equals(preferIPv6AddressesValue) && "false".equals(preferIPv4StackValue)) { try { udpEndpoint.publish("soap.udp://[FF02::C]:3702"); started = true; } catch (Exception e) { LOG.log(Level.WARNING, "Could not start WS-Discovery Service with ipv6 address", e); } } if (!started) { udpEndpoint.publish("soap.udp://239.255.255.250:3702"); started = true; } } catch (RuntimeException ex) { if (!optional) { throw ex; } LOG.log(Level.WARNING, "Could not start WS-Discovery Service.", ex); } finally { if (b != bus) { BusFactory.setThreadDefaultBus(b); } } } return true; }
Example #23
Source File: SonosConfiguration.java From airsonic with GNU General Public License v3.0 | 5 votes |
@Bean public Endpoint sonosEndpoint(SonosService sonosService, SonosFaultInterceptor sonosFaultInterceptor) { EndpointImpl endpoint = new EndpointImpl(sonosService); endpoint.publish("/Sonos"); endpoint.setOutFaultInterceptors(Collections.singletonList(sonosFaultInterceptor)); return endpoint; }
Example #24
Source File: JMSTransactionTest.java From cxf with Apache License 2.0 | 5 votes |
@BeforeClass public static void startServers() throws Exception { startBusAndJMS(JMSTransactionTest.class); //startBusAndJMS("tcp://localhost:61616"); endpoint = new EndpointImpl(bus, new GreeterImplWithTransaction()); endpoint.setAddress(SERVICE_ADDRESS); endpoint.setFeatures(Collections.singletonList(cff)); endpoint.publish(); }
Example #25
Source File: WSDLAddressRewriteTest.java From cxf with Apache License 2.0 | 5 votes |
private Endpoint publishEndpoint(boolean autoRewriteSoapAddress) { Endpoint endpoint = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/GreeterPort", new GreeterImpl()); EndpointInfo ei = ((EndpointImpl)endpoint).getServer().getEndpoint().getEndpointInfo(); ei.setProperty("autoRewriteSoapAddress", autoRewriteSoapAddress); return endpoint; }
Example #26
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { // We use a null binding id in the call to EndpointImpl // constructor. Why? final String nullBindingID = null; // We need to specify to use defaults on constructing the // bus, because our configuration file doesn't have // everything needed. final boolean useDefaults = true; // We configure a new bus for this server. setBus(new SpringBusFactory().createBus(configFileURL, useDefaults)); // This impl class must have the appropriate annotations // to match the WSDL file that we are using. Object implementor = new GreeterImpl(name); // I don't know why this works. ep = new EndpointImpl( getBus(), implementor, nullBindingID, this.getClass().getResource("greeting.wsdl").toString()); // How the hell do I know what the name of the // http-destination is from using this call? ep.setEndpointName(new QName("http://apache.org/hello_world", name)); ep.publish(address); }
Example #27
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { // We use a null binding id in the call to EndpointImpl // constructor. Why? final String nullBindingID = null; // We need to specify to use defaults on constructing the // bus, because our configuration file doesn't have // everything needed. final boolean useDefaults = true; // We configure a new bus for this server. setBus(new SpringBusFactory().createBus(configFileURL, useDefaults)); // This impl class must have the appropriate annotations // to match the WSDL file that we are using. Object implementor = new GreeterImpl(name); // I don't know why this works. ep = new EndpointImpl( getBus(), implementor, nullBindingID, this.getClass().getResource("greeting.wsdl").toString()); // How the hell do I know what the name of the // http-destination is from using this call? ep.setEndpointName(new QName("http://apache.org/hello_world", name)); ep.publish(address); }
Example #28
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { Object implementor = new AddNumberImpl(); String address = "http://localhost:" + PORT + "/jaxws/add"; EndpointImpl ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), implementor, null, getWsdl()); ep.publish(address); eps.add(ep); eps.add(Endpoint.publish(address + "-provider", new AddNumberProvider())); eps.add(Endpoint.publish(address + "-providernows", new AddNumberProviderNoWsdl())); }
Example #29
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { Object implementor = new HelloImpl(); String address = "http://localhost:" + PORT + "/wsa/responses"; ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), implementor, null, getWsdl()); ep.publish(address); }
Example #30
Source File: Server.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { setBus(BusFactory.getDefaultBus()); Object implementor = new AddNumberImpl(); String address = "http://localhost:" + PORT + "/jaxws/addmex"; ep = new EndpointImpl(BusFactory.getThreadDefaultBus(), implementor, null, getWsdl()); ep.publish(address); }