Search in sources :

Example 6 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project cxf by apache.

the class DocLiteralInInterceptorTest method setUpUsingDocLit.

private void setUpUsingDocLit() throws Exception {
    String ns = "http://apache.org/hello_world_doc_lit_bare";
    WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource("/wsdl/jaxb/doc_lit_bare.wsdl").toString(), new QName(ns, "SOAPService"));
    service = factory.create();
    endpointInfo = service.getEndpointInfo(new QName(ns, "SoapPort"));
    endpoint = new EndpointImpl(bus, service, endpointInfo);
    JAXBDataBinding db = new JAXBDataBinding();
    db.setContext(JAXBContext.newInstance(new Class[] { TradePriceData.class }));
    service.setDataBinding(db);
    operation = endpointInfo.getBinding().getOperation(new QName(ns, "SayHi"));
    operation.getOperationInfo().getInput().getMessagePartByIndex(0).setTypeClass(TradePriceData.class);
    operation.getOperationInfo().getOutput().getMessagePartByIndex(0).setTypeClass(TradePriceData.class);
    message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    exchange.put(Service.class, service);
    exchange.put(Endpoint.class, endpoint);
    exchange.put(Binding.class, endpoint.getBinding());
}
Also used : Exchange(org.apache.cxf.message.Exchange) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) TradePriceData(org.apache.hello_world_doc_lit_bare.types.TradePriceData) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 7 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project cxf by apache.

the class DocLiteralInInterceptorTest method setUpUsingHelloWorld.

private void setUpUsingHelloWorld() throws Exception {
    String ns = "http://apache.org/hello_world_soap_http";
    WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource("/wsdl/jaxb/hello_world.wsdl").toString(), new QName(ns, "SOAPService"));
    service = factory.create();
    endpointInfo = service.getEndpointInfo(new QName(ns, "SoapPort"));
    endpoint = new EndpointImpl(bus, service, endpointInfo);
    JAXBDataBinding db = new JAXBDataBinding();
    db.setContext(JAXBContext.newInstance(new Class[] { GreetMe.class, GreetMeResponse.class }));
    service.setDataBinding(db);
    operation = endpointInfo.getBinding().getOperation(new QName(ns, "greetMe"));
    operation.getOperationInfo().getInput().getMessagePartByIndex(0).setTypeClass(GreetMe.class);
    operation.getOperationInfo().getOutput().getMessagePartByIndex(0).setTypeClass(GreetMeResponse.class);
    message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    exchange.put(Service.class, service);
    exchange.put(Endpoint.class, endpoint);
    exchange.put(Binding.class, endpoint.getBinding());
}
Also used : GreetMe(org.apache.hello_world_soap_http.types.GreetMe) Exchange(org.apache.cxf.message.Exchange) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) GreetMeResponse(org.apache.hello_world_soap_http.types.GreetMeResponse) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 8 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project cxf by apache.

the class AbstractJAXRSFactoryBean method createEndpoint.

protected Endpoint createEndpoint() throws BusException, EndpointException {
    Service service = serviceFactory.getService();
    if (service == null) {
        service = serviceFactory.create();
    }
    EndpointInfo ei = createEndpointInfo(service);
    Endpoint ep = new EndpointImpl(getBus(), service, ei);
    if (properties != null) {
        ep.putAll(properties);
    }
    if (getInInterceptors() != null) {
        ep.getInInterceptors().addAll(getInInterceptors());
    }
    if (getOutInterceptors() != null) {
        ep.getOutInterceptors().addAll(getOutInterceptors());
    }
    if (getInFaultInterceptors() != null) {
        ep.getInFaultInterceptors().addAll(getInFaultInterceptors());
    }
    if (getOutFaultInterceptors() != null) {
        ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
    }
    List<ClassResourceInfo> list = serviceFactory.getRealClassResourceInfo();
    for (ClassResourceInfo cri : list) {
        initializeAnnotationInterceptors(ep, cri.getServiceClass());
        serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep, cri.getServiceClass(), null);
    }
    ep.put(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
    return ep;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) ClassResourceInfo(org.apache.cxf.jaxrs.model.ClassResourceInfo) Service(org.apache.cxf.service.Service)

Example 9 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project cxf by apache.

the class AbstractSTSClient method createClient.

protected void createClient() throws BusException, EndpointException {
    if (client != null) {
        return;
    }
    if (wsdlLocation != null) {
        WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlLocation, serviceName);
        SourceDataBinding dataBinding = new SourceDataBinding();
        factory.setDataBinding(dataBinding);
        Service service = factory.create();
        service.setDataBinding(dataBinding);
        EndpointInfo ei = service.getEndpointInfo(endpointName);
        Endpoint endpoint = new EndpointImpl(bus, service, ei);
        client = new ClientImpl(bus, endpoint);
    } else if (location != null) {
        Endpoint endpoint = STSUtils.createSTSEndpoint(bus, namespace, null, location, soapVersion, policy, endpointName);
        client = new ClientImpl(bus, endpoint);
    } else {
        throw new TrustException(LOG, "NO_LOCATION");
    }
    client.getInFaultInterceptors().addAll(inFault);
    client.getInInterceptors().addAll(in);
    client.getOutInterceptors().addAll(out);
    client.getOutFaultInterceptors().addAll(outFault);
    if (tlsClientParameters != null) {
        HTTPConduit http = (HTTPConduit) client.getConduit();
        http.setTlsClientParameters(tlsClientParameters);
    }
    in = null;
    out = null;
    inFault = null;
    outFault = null;
    if (features != null) {
        for (Feature f : features) {
            f.initialize(client, bus);
        }
    }
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) Service(org.apache.cxf.service.Service) ClientImpl(org.apache.cxf.endpoint.ClientImpl) SourceDataBinding(org.apache.cxf.databinding.source.SourceDataBinding) Feature(org.apache.cxf.feature.Feature)

Example 10 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project cxf by apache.

the class RMEndpointTest method testCreateEndpoint.

@Test
public void testCreateEndpoint() throws NoSuchMethodException, EndpointException {
    Method m = RMEndpoint.class.getDeclaredMethod("getUsingAddressing", new Class[] { EndpointInfo.class });
    Service as = control.createMock(Service.class);
    EndpointInfo aei = new EndpointInfo();
    ae = new EndpointImpl(null, as, aei);
    rme = EasyMock.createMockBuilder(RMEndpoint.class).withConstructor(manager, ae).addMockedMethod(m).createMock(control);
    rme.setAplicationEndpoint(ae);
    rme.setManager(manager);
    SoapBindingInfo bi = control.createMock(SoapBindingInfo.class);
    aei.setBinding(bi);
    SoapVersion sv = Soap11.getInstance();
    EasyMock.expect(bi.getSoapVersion()).andReturn(sv);
    String ns = "http://schemas.xmlsoap.org/wsdl/soap/";
    EasyMock.expect(bi.getBindingId()).andReturn(ns);
    aei.setTransportId(ns);
    String addr = "addr";
    aei.setAddress(addr);
    Object ua = new Object();
    EasyMock.expect(rme.getUsingAddressing(aei)).andReturn(ua);
    control.replay();
    rme.createServices();
    rme.createEndpoints(null);
    Endpoint e = rme.getEndpoint(ProtocolVariation.RM10WSA200408);
    WrappedEndpoint we = (WrappedEndpoint) e;
    assertSame(ae, we.getWrappedEndpoint());
    Service s = rme.getService(ProtocolVariation.RM10WSA200408);
    assertEquals(1, s.getEndpoints().size());
    assertSame(e, s.getEndpoints().get(RM10Constants.PORT_NAME));
}
Also used : SoapVersion(org.apache.cxf.binding.soap.SoapVersion) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) Service(org.apache.cxf.service.Service) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

EndpointImpl (org.apache.cxf.endpoint.EndpointImpl)31 Endpoint (org.apache.cxf.endpoint.Endpoint)24 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)18 Service (org.apache.cxf.service.Service)14 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)13 QName (javax.xml.namespace.QName)12 Exchange (org.apache.cxf.message.Exchange)12 MessageImpl (org.apache.cxf.message.MessageImpl)12 WSDLServiceFactory (org.apache.cxf.wsdl11.WSDLServiceFactory)9 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)8 Feature (org.apache.cxf.feature.Feature)7 ServiceImpl (org.apache.cxf.service.ServiceImpl)7 BindingInfo (org.apache.cxf.service.model.BindingInfo)7 Bus (org.apache.cxf.Bus)6 Message (org.apache.cxf.message.Message)6 ArrayList (java.util.ArrayList)5 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)5 AbstractFeature (org.apache.cxf.feature.AbstractFeature)5 List (java.util.List)4 SourceDataBinding (org.apache.cxf.databinding.source.SourceDataBinding)4