use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class ManagedConnectionImpl method getCXFConnection.
public synchronized Object getCXFConnection(Subject subject, ConnectionRequestInfo crInfo) throws ResourceException {
CXFConnectionRequestInfo requestInfo = (CXFConnectionRequestInfo) crInfo;
Class<?> serviceInterface = requestInfo.getInterface();
ClassLoader orig = Thread.currentThread().getContextClassLoader();
try {
final ClientProxyFactoryBean factoryBean;
if (isJaxWsServiceInterface(serviceInterface)) {
factoryBean = new JaxWsProxyFactoryBean();
} else {
factoryBean = new ClientProxyFactoryBean();
}
factoryBean.setServiceClass(serviceInterface);
if (requestInfo.getServiceName() != null) {
factoryBean.getServiceFactory().setServiceName(requestInfo.getServiceName());
}
if (requestInfo.getPortName() != null) {
factoryBean.getServiceFactory().setEndpointName(requestInfo.getPortName());
}
if (requestInfo.getWsdlLocation() != null) {
factoryBean.getServiceFactory().setWsdlURL(requestInfo.getWsdlLocation());
}
if (requestInfo.getAddress() != null) {
factoryBean.setAddress(requestInfo.getAddress());
}
Object obj = factoryBean.create();
setSubject(subject);
return createConnectionProxy(obj, requestInfo, subject);
} catch (WebServiceException wse) {
throw new ResourceAdapterInternalException(new Message("FAILED_TO_GET_CXF_CONNECTION", BUNDLE, requestInfo).toString(), wse);
} finally {
Thread.currentThread().setContextClassLoader(orig);
}
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class StudentTest method testReturnMapDocLiteral.
@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());
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class StudentTest method testReturnMap.
@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"));
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class MapsTest method setUp.
@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();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class AsyncHTTPConduitTest method testInvocationWithTransportId.
@Test
public void testInvocationWithTransportId() throws Exception {
String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(Greeter.class);
factory.setAddress(address);
factory.setTransportId("http://cxf.apache.org/transports/http/http-client");
Greeter greeter = factory.create(Greeter.class);
String response = greeter.greetMe("test");
assertEquals("Get a wrong response", "Hello test", response);
}
Aggregations