use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class ColocOutInterceptor method isColocated.
protected Server isColocated(List<Server> servers, Endpoint endpoint, BindingOperationInfo boi) {
if (servers != null) {
Service senderService = endpoint.getService();
EndpointInfo senderEI = endpoint.getEndpointInfo();
for (Server s : servers) {
Endpoint receiverEndpoint = s.getEndpoint();
Service receiverService = receiverEndpoint.getService();
EndpointInfo receiverEI = receiverEndpoint.getEndpointInfo();
if (receiverService.getName().equals(senderService.getName()) && receiverEI.getName().equals(senderEI.getName())) {
// Check For Operation Match.
BindingOperationInfo receiverOI = receiverEI.getBinding().getOperation(boi.getName());
if (receiverOI != null && isCompatibleOperationInfo(boi, receiverOI)) {
return s;
}
}
}
}
return null;
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class StudentTest method testMapMap.
@Test
public void testMapMap() throws Exception {
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceClass(StudentServiceDocLiteral.class);
sf.setServiceBean(new StudentServiceDocLiteralImpl());
sf.setAddress("local://StudentServiceDocLiteral");
setupAegis(sf);
Server server = sf.create();
server.start();
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setAddress("local://StudentServiceDocLiteral");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
// CHECKSTYLE:OFF
HashMap<String, Student> mss = new HashMap<>();
mss.put("Alice", new Student());
HashMap<String, HashMap<String, Student>> mmss = new HashMap<>();
mmss.put("Bob", mss);
StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class);
clientInterface.takeMapMap(mmss);
// CHECKSTYLE:ON
}
use of org.apache.cxf.endpoint.Server 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.endpoint.Server 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.endpoint.Server in project cxf by apache.
the class CodeFirstTest method testCXF2766.
@Test
public void testCXF2766() throws Exception {
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(CXF2766.class);
factory.setServiceBean(new CXF2766Impl());
factory.setAddress("local://localhost/testcxf2766");
Server server = factory.create();
server.getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
server.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
Document doc = getWSDLDocument(server);
// org.apache.cxf.helpers.XMLUtils.printDOM(doc);
assertValid("//wsdl:message[@name='doReturnResponse']/wsdl:part[@name='returnResponse']", doc);
QName serviceName = new QName("http://cxf.apache.org/service.wsdl", "BareService");
QName portName = new QName("http://cxf.apache.org/service.wsdl", "BarePort");
ServiceImpl service = new ServiceImpl(getBus(), (URL) null, serviceName, null);
service.addPort(portName, "http://schemas.xmlsoap.org/soap/", "local://localhost/testcxf2766");
CXF2766 proxy = service.getPort(portName, CXF2766.class);
proxy.doReturn(new ReturnRequestType());
}
Aggregations