Java Code Examples for org.apache.cxf.jaxws.JaxWsProxyFactoryBean#setBus()
The following examples show how to use
org.apache.cxf.jaxws.JaxWsProxyFactoryBean#setBus() .
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: ExceptionTest.java From cxf with Apache License 2.0 | 6 votes |
@Test(expected = HelloException.class) public void testJaxws() throws Exception { JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); sfbean.setServiceClass(ExceptionService.class); setupAegis(sfbean); sfbean.setAddress("local://ExceptionService4"); Server server = sfbean.create(); Service service = server.getEndpoint().getService(); service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://ExceptionService4"); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); ExceptionService clientInterface = proxyFac.create(ExceptionService.class); clientInterface.sayHiWithException(); }
Example 2
Source File: JaxwsClientToCxfServerIT.java From tracee with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Before public void setup() { final Bus bus = CXFBusFactory.getThreadDefaultBus(); JaxWsServerFactoryBean jaxWsServer = createJaxWsServer(); jaxWsServer.getFeatures().add(new LoggingFeature()); jaxWsServer.getFeatures().add(new TraceeCxfFeature(serverBackend, Profile.DEFAULT)); server = jaxWsServer.create(); JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean(); factoryBean.setServiceClass(HelloWorldTestService.class); factoryBean.setAddress(endpointAddress); factoryBean.getHandlers().add(new TraceeClientHandler(clientBackend)); factoryBean.setBus(bus); helloWorldPort = factoryBean.create(HelloWorldTestService.class); }
Example 3
Source File: ResourceTest.java From cxf with Apache License 2.0 | 6 votes |
protected Resource createClient(ReferenceParametersType refParams) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(Resource.class); factory.setAddress(RESOURCE_LOCAL_ADDRESS); Resource proxy = (Resource) factory.create(); // Add reference parameters AddressingProperties addrProps = new AddressingProperties(); EndpointReferenceType endpoint = new EndpointReferenceType(); endpoint.setReferenceParameters(refParams); endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS)); addrProps.setTo(endpoint); ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); return proxy; }
Example 4
Source File: IntegrationBaseTest.java From cxf with Apache License 2.0 | 6 votes |
protected Resource createClient(ReferenceParametersType refParams) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); Map<String, Object> props = factory.getProperties(); if (props == null) { props = new HashMap<>(); } props.put("jaxb.additionalContextClasses", ExpressionType.class); factory.setProperties(props); factory.setBus(bus); factory.setServiceClass(Resource.class); factory.setAddress(RESOURCE_ADDRESS); Resource proxy = (Resource) factory.create(); // Add reference parameters AddressingProperties addrProps = new AddressingProperties(); EndpointReferenceType endpoint = new EndpointReferenceType(); endpoint.setReferenceParameters(refParams); endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS)); addrProps.setTo(endpoint); ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); return proxy; }
Example 5
Source File: StudentTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testReturnMapDocLiteral() throws Exception { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass(StudentServiceDocLiteral.class); sf.setServiceBean(new StudentServiceDocLiteralImpl()); sf.setAddress("local://StudentServiceDocLiteral"); setupAegis(sf); Server server = sf.create(); server.start(); JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://StudentServiceDocLiteral"); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class); Map<Long, Student> fullMap = clientInterface.getStudentsMap(); assertNotNull(fullMap); Student one = fullMap.get(Long.valueOf(1)); assertNotNull(one); assertEquals("Student1", one.getName()); }
Example 6
Source File: StudentTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testReturnMap() throws Exception { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass(StudentService.class); sf.setServiceBean(new StudentServiceImpl()); sf.setAddress("local://StudentService"); setupAegis(sf); Server server = sf.create(); server.start(); JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://StudentService"); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); StudentService clientInterface = proxyFac.create(StudentService.class); Map<Long, Student> fullMap = clientInterface.getStudentsMap(); assertNotNull(fullMap); Student one = fullMap.get(Long.valueOf(1)); assertNotNull(one); assertEquals("Student1", one.getName()); Map<String, ?> wildMap = clientInterface.getWildcardMap(); assertEquals("valuestring", wildMap.get("keystring")); }
Example 7
Source File: MapsTest.java From cxf with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { super.setUp(); JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass(MapTest.class); sf.setServiceBean(new MapTestImpl()); sf.setAddress("local://MapTest"); setupAegis(sf); server = sf.create(); // server.getEndpoint().getInInterceptors().add(new LoggingInInterceptor()); // server.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor()); server.start(); JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://MapTest"); proxyFac.setServiceClass(MapTest.class); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); clientInterface = (MapTest)proxyFac.create(); }
Example 8
Source File: ExceptionTest.java From cxf with Apache License 2.0 | 6 votes |
@Test(expected = HelloException.class) public void testJaxwsNoXfireCompat() throws Exception { JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); sfbean.setServiceClass(ExceptionService.class); sfbean.setDataBinding(new AegisDatabinding()); sfbean.getServiceFactory().setDataBinding(sfbean.getDataBinding()); sfbean.setAddress("local://ExceptionServiceJaxWs"); Server server = sfbean.create(); Service service = server.getEndpoint().getService(); service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://ExceptionServiceJaxWs"); proxyFac.setServiceClass(ExceptionService.class); proxyFac.setBus(getBus()); proxyFac.getClientFactoryBean().getServiceFactory().setDataBinding(new AegisDatabinding()); ExceptionService clientInterface = (ExceptionService)proxyFac.create(); clientInterface.sayHiWithException(); }
Example 9
Source File: SoapJmsSpecTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testGzip() throws Exception { URL wsdl = getWSDLURL(WSDL); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(JMSGreeterPortType.class); factory.setWsdlURL(wsdl.toExternalForm()); factory.getFeatures().add(cff); factory.getFeatures().add(new GZIPFeature()); factory.setAddress("jms:queue:test.cxf.jmstransport.queue6"); JMSGreeterPortType greeter = (JMSGreeterPortType)markForClose(factory.create()); for (int idx = 0; idx < 5; idx++) { greeter.greetMeOneWay("test String"); String greeting = greeter.greetMe("Milestone-" + idx); Assert.assertEquals("Hello Milestone-" + idx, greeting); String reply = greeter.sayHi(); Assert.assertEquals("Bonjour", reply); } }
Example 10
Source File: JaxwsClientToJaxwsServerIT.java From tracee with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Before public void setup() { JaxWsServerFactoryBean jaxWsServer = createJaxWsServer(); jaxWsServer.getHandlers().add(new TraceeServerHandler(serverBackend, new SoapHeaderTransport())); server = jaxWsServer.create(); JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean(); factoryBean.setServiceClass(HelloWorldTestService.class); factoryBean.setAddress(endpointAddress); factoryBean.getHandlers().add(new TraceeClientHandler(clientBackend)); factoryBean.setBus(CXFBusFactory.getDefaultBus()); helloWorldPort = factoryBean.create(HelloWorldTestService.class); }
Example 11
Source File: SoapActionTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testSoap12Endpoint() throws Exception { JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean(); pf.setServiceClass(Greeter.class); pf.setAddress(add12); SoapBindingConfiguration config = new SoapBindingConfiguration(); config.setVersion(Soap12.getInstance()); pf.setBindingConfig(config); pf.setBus(bus); Greeter greeter = (Greeter) pf.create(); assertEquals("sayHi", greeter.sayHi("test")); assertEquals("sayHi2", greeter.sayHi2("test")); }
Example 12
Source File: XKMSClientFactory.java From cxf with Apache License 2.0 | 5 votes |
public static XKMSPortType create(String endpointAddress, Bus bus) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(XKMSPortType.class); factory.setAddress(endpointAddress); Map<String, Object> properties = new HashMap<>(); properties.put("jaxb.additionalContextClasses", new Class[] {ResultDetails.class}); factory.setProperties(properties); return (XKMSPortType)factory.create(); }
Example 13
Source File: SoapActionTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testEndpoint() throws Exception { JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean(); pf.setServiceClass(Greeter.class); pf.setAddress(add11); pf.setBus(bus); Greeter greeter = (Greeter) pf.create(); assertEquals("sayHi", greeter.sayHi("test")); assertEquals("sayHi2", greeter.sayHi2("test")); }
Example 14
Source File: JavaFirstNoWsdlTest.java From cxf with Apache License 2.0 | 5 votes |
private void specNoWsdlService(String messageType) throws Exception { String address = SERVICE_ADDRESS + ((messageType != null) ? "&messageType=" + messageType : ""); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.getFeatures().add(cff); factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID); factory.setServiceClass(Hello.class); factory.setAddress(address); Hello client = (Hello)markForClose(factory.create()); String reply = client.sayHi(" HI"); Assert.assertEquals("get HI", reply); }
Example 15
Source File: JMSTransactionTest.java From cxf with Apache License 2.0 | 5 votes |
private Greeter createGreeterProxy() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.getFeatures().add(cff); factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID); factory.setServiceClass(Greeter.class); factory.setAddress(SERVICE_ADDRESS); return (Greeter)markForClose(factory.create()); }
Example 16
Source File: WSAFeatureXmlTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testClientProxyFactory() { JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean(); cf.setAddress("http://localhost:" + PORT + "/test"); cf.setServiceClass(Greeter.class); cf.setBus(getBus()); Configurer c = getBus().getExtension(Configurer.class); c.configureBean("client.proxyFactory", cf); Greeter greeter = (Greeter) cf.create(); Client client = ClientProxy.getClient(greeter); checkAddressInterceptors(client.getInInterceptors()); }
Example 17
Source File: MEXTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testGet() { // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setBus(getStaticBus()); proxyFac.setAddress("http://localhost:" + PORT + "/jaxws/addmex"); proxyFac.getFeatures().add(new LoggingFeature()); MetadataExchange exc = proxyFac.create(MetadataExchange.class); Metadata metadata = exc.get2004(); assertNotNull(metadata); assertEquals(2, metadata.getMetadataSection().size()); assertEquals("http://schemas.xmlsoap.org/wsdl/", metadata.getMetadataSection().get(0).getDialect()); assertEquals("http://apache.org/cxf/systest/ws/addr_feature/", metadata.getMetadataSection().get(0).getIdentifier()); assertEquals("http://www.w3.org/2001/XMLSchema", metadata.getMetadataSection().get(1).getDialect()); GetMetadata body = new GetMetadata(); body.setDialect("http://www.w3.org/2001/XMLSchema"); metadata = exc.getMetadata(body); assertEquals(1, metadata.getMetadataSection().size()); assertEquals("http://www.w3.org/2001/XMLSchema", metadata.getMetadataSection().get(0).getDialect()); }
Example 18
Source File: ResourceFactoryTest.java From cxf with Apache License 2.0 | 5 votes |
private ResourceFactory createClient() { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(ResourceFactory.class); factory.setAddress(RESOURCE_FACTORY_ADDRESS); return (ResourceFactory) factory.create(); }
Example 19
Source File: SimpleEventingIntegrationTest.java From cxf with Apache License 2.0 | 5 votes |
@Before public void createClient() { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(EventSourceEndpoint.class); factory.setAddress(URL_EVENT_SOURCE); eventSourceClient = (EventSourceEndpoint)factory.create(); }
Example 20
Source File: SimpleEventingIntegrationTest.java From cxf with Apache License 2.0 | 5 votes |
/** * Convenience method to create a client for the testing Subscription Manager * which is located at local://SimpleSubscriptionManager. * You have to specify the reference parameters you obtained from the Event Source * when your subscription was created. * * @return a JAX-WS client set up for managing the subscription you had created using the Event Source */ public SubscriptionManagerEndpoint createSubscriptionManagerClient(ReferenceParametersType refs) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(SubscriptionManagerEndpoint.class); factory.setAddress(URL_SUBSCRIPTION_MANAGER); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); ReferenceParametersAddingHandler handler = new ReferenceParametersAddingHandler(refs); factory.getHandlers().add(handler); return (SubscriptionManagerEndpoint)factory.create(); }