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());
}
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());
}
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;
}
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);
}
}
}
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));
}
Aggregations