use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class EndpointSelectionInterceptor method selectEndpoint.
protected Endpoint selectEndpoint(Message message, Set<Endpoint> eps) {
SoapVersion sv = ((SoapMessage) message).getVersion();
for (Endpoint e : eps) {
EndpointInfo ei = e.getEndpointInfo();
BindingInfo binding = ei.getBinding();
if (binding instanceof SoapBindingInfo && ((SoapBindingInfo) binding).getSoapVersion().equals(sv)) {
return e;
}
}
return null;
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class RequestPreprocessorTest method mockMessage.
private Message mockMessage(String baseAddress, String pathInfo, String query, String method, String methodHeader) {
Message m = new MessageImpl();
m.put("org.apache.cxf.http.case_insensitive_queries", false);
m.put("org.apache.cxf.endpoint.private", false);
Exchange e = new ExchangeImpl();
m.setExchange(e);
control.reset();
Endpoint endp = control.mock(Endpoint.class);
e.put(Endpoint.class, endp);
EasyMock.expect(endp.isEmpty()).andReturn(true).anyTimes();
EasyMock.expect(endp.get(ServerProviderFactory.class.getName())).andReturn(ServerProviderFactory.getInstance()).anyTimes();
ServletDestination d = control.createMock(ServletDestination.class);
e.setDestination(d);
EndpointInfo epr = new EndpointInfo();
epr.setAddress(baseAddress);
EasyMock.expect(d.getEndpointInfo()).andReturn(epr).anyTimes();
EasyMock.expect(endp.getEndpointInfo()).andReturn(epr).anyTimes();
m.put(Message.REQUEST_URI, pathInfo);
m.put(Message.QUERY_STRING, query);
m.put(Message.HTTP_REQUEST_METHOD, method);
Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
if (methodHeader != null) {
headers.put("X-HTTP-Method-Override", Collections.singletonList(methodHeader));
}
m.put(Message.PROTOCOL_HEADERS, headers);
BindingInfo bi = control.createMock(BindingInfo.class);
epr.setBinding(bi);
EasyMock.expect(bi.getProperties()).andReturn(Collections.emptyMap()).anyTimes();
control.replay();
return m;
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class DispatchImpl method addInvokeOperation.
private void addInvokeOperation(QName operationName, boolean oneWay) {
ServiceInfo info = client.getEndpoint().getEndpointInfo().getService();
OperationInfo invokeOpInfo = info.getInterface().getOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME);
OperationInfo opInfo = info.getInterface().addOperation(operationName);
opInfo.setInput(invokeOpInfo.getInputName(), invokeOpInfo.getInput());
if (!oneWay) {
opInfo.setOutput(invokeOpInfo.getOutputName(), invokeOpInfo.getOutput());
}
for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) {
BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo);
bind.addOperation(bo);
}
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class ServiceImpl method createEndpointInfo.
private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean serviceFactory, QName portName, PortInfoImpl portInfo) throws BusException {
String address = portInfo.getAddress();
String bindingID = BindingID.getBindingID(portInfo.getBindingID());
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
// the bindingId might be the transportId, just attempt to
// load it to force the factory to load
dfm.getDestinationFactory(bindingID);
} catch (BusException ex) {
// ignore
}
DestinationFactory df = dfm.getDestinationFactoryForUri(address);
final String transportId;
if (df != null && df.getTransportIds() != null && !df.getTransportIds().isEmpty()) {
transportId = df.getTransportIds().get(0);
} else {
transportId = bindingID;
}
Object config = null;
if (serviceFactory instanceof JaxWsServiceFactoryBean) {
config = new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean) serviceFactory);
}
BindingInfo bindingInfo = bus.getExtension(BindingFactoryManager.class).getBindingFactory(bindingID).createBindingInfo(serviceFactory.getService(), bindingID, config);
Service service = serviceFactory.getService();
service.getServiceInfos().get(0).addBinding(bindingInfo);
EndpointInfo ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);
ei.setName(portName);
ei.setAddress(address);
ei.setBinding(bindingInfo);
service.getServiceInfos().get(0).addEndpoint(ei);
return ei;
}
use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.
the class ServiceImpl method createDispatchService.
private AbstractServiceFactoryBean createDispatchService(DataBinding db) {
AbstractServiceFactoryBean serviceFactory;
final Service dispatchService;
if (null != wsdlURL) {
WSDLServiceFactory sf = new WSDLServiceFactory(bus, wsdlURL, serviceName);
dispatchService = sf.create();
dispatchService.setDataBinding(db);
serviceFactory = sf;
} else {
ReflectionServiceFactoryBean sf = new JaxWsServiceFactoryBean();
sf.setBus(bus);
sf.setServiceName(serviceName);
// maybe we can find another way to create service which have no SEI
sf.setServiceClass(DummyImpl.class);
sf.setDataBinding(db);
dispatchService = sf.create();
serviceFactory = sf;
}
configureObject(dispatchService);
for (ServiceInfo si : dispatchService.getServiceInfos()) {
si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
if (null == wsdlURL) {
for (EndpointInfo ei : si.getEndpoints()) {
ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
}
}
for (BindingInfo bind : si.getBindings()) {
for (BindingOperationInfo bop : bind.getOperations()) {
// force to bare, no unwrapping
if (bop.isUnwrappedCapable()) {
bop.getOperationInfo().setUnwrappedOperation(null);
bop.setUnwrappedOperation(null);
}
}
}
}
return serviceFactory;
}
Aggregations