Search in sources :

Example 31 with Server

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;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Server(org.apache.cxf.endpoint.Server) Endpoint(org.apache.cxf.endpoint.Endpoint) Service(org.apache.cxf.service.Service)

Example 32 with Server

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
}
Also used : Server(org.apache.cxf.endpoint.Server) HashMap(java.util.HashMap) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 33 with Server

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());
}
Also used : Server(org.apache.cxf.endpoint.Server) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 34 with Server

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"));
}
Also used : Server(org.apache.cxf.endpoint.Server) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 35 with Server

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());
}
Also used : Server(org.apache.cxf.endpoint.Server) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) QName(javax.xml.namespace.QName) ArrayServiceImpl(org.apache.cxf.jaxws.service.ArrayServiceImpl) FooServiceImpl(org.apache.cxf.jaxws.service.FooServiceImpl) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

Server (org.apache.cxf.endpoint.Server)199 Test (org.junit.Test)119 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)54 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)52 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)50 Resource (org.apache.cxf.ws.transfer.resource.Resource)50 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)47 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)44 Element (org.w3c.dom.Element)44 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)33 Put (org.apache.cxf.ws.transfer.Put)33 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)32 Service (org.apache.cxf.service.Service)27 Bus (org.apache.cxf.Bus)25 PutResponse (org.apache.cxf.ws.transfer.PutResponse)25 Endpoint (org.apache.cxf.endpoint.Endpoint)21 ArrayList (java.util.ArrayList)18 QName (javax.xml.namespace.QName)18 ServerRegistry (org.apache.cxf.endpoint.ServerRegistry)18 Document (org.w3c.dom.Document)18