Java Code Examples for org.apache.cxf.service.model.ServiceInfo#getEndpoints()
The following examples show how to use
org.apache.cxf.service.model.ServiceInfo#getEndpoints() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CxfWSDLImporter.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected WSService importService(ServiceInfo service) { String name = service.getName().getLocalPart(); String location = ""; for (EndpointInfo endpoint : service.getEndpoints()) { location = endpoint.getAddress(); } WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation); for (OperationInfo operation : service.getInterface().getOperations()) { WSOperation wsOperation = this.importOperation(operation, wsService); wsService.addOperation(wsOperation); this.wsOperations.put(this.namespace + operation.getName().getLocalPart(), wsOperation); } return wsService; }
Example 2
Source File: CxfWSDLImporter.java From flowable-engine with Apache License 2.0 | 6 votes |
protected WSService importService(ServiceInfo service) { String name = service.getName().getLocalPart(); String location = ""; for (EndpointInfo endpoint : service.getEndpoints()) { location = endpoint.getAddress(); } WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation); for (OperationInfo operation : service.getInterface().getOperations()) { WSOperation wsOperation = this.importOperation(operation, wsService); wsService.addOperation(wsOperation); this.wsOperations.put(this.namespace + operation.getName().getLocalPart(), wsOperation); } return wsService; }
Example 3
Source File: AbstractStaticFailoverStrategy.java From cxf with Apache License 2.0 | 5 votes |
/** * Get the endpoints for this invocation. * * @param exchange the current Exchange * @param acceptCandidatesWithSameAddress true to accept candidates with the same address * @return a List of alternate endpoints if available */ protected List<Endpoint> getEndpoints(Exchange exchange, boolean acceptCandidatesWithSameAddress) { Endpoint endpoint = exchange.getEndpoint(); Collection<ServiceInfo> services = endpoint.getService().getServiceInfos(); // If there are no services associated with this endpoint (often in case of JAX-RS), // returning the endpoint itself if allowed. if (services.isEmpty() && acceptCandidatesWithSameAddress) { return Collections.singletonList(endpoint); } QName currentBinding = endpoint.getBinding().getBindingInfo().getName(); List<Endpoint> alternates = new ArrayList<>(); for (ServiceInfo service : services) { Collection<EndpointInfo> candidates = service.getEndpoints(); for (EndpointInfo candidate : candidates) { QName candidateBinding = candidate.getBinding().getName(); if (candidateBinding.equals(currentBinding)) { if (acceptCandidatesWithSameAddress || !candidate.getAddress().equals( endpoint.getEndpointInfo().getAddress())) { Endpoint alternate = endpoint.getService().getEndpoints().get(candidate.getName()); if (alternate != null) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "FAILOVER_CANDIDATE_ACCEPTED", candidate.getName()); } alternates.add(alternate); } } } else if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "FAILOVER_CANDIDATE_REJECTED", new Object[] {candidate.getName(), candidateBinding}); } } } return alternates; }
Example 4
Source File: ReflectionServiceFactoryBean.java From cxf with Apache License 2.0 | 5 votes |
protected void createEndpoints() { Service service = getService(); BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class); for (ServiceInfo inf : service.getServiceInfos()) { for (EndpointInfo ei : inf.getEndpoints()) { for (BindingOperationInfo boi : ei.getBinding().getOperations()) { updateBindingOperation(boi); } try { bfm.getBindingFactory(ei.getBinding().getBindingId()); } catch (BusException e1) { continue; } try { Endpoint ep = createEndpoint(ei); service.getEndpoints().put(ei.getName(), ep); } catch (EndpointException e) { throw new ServiceConstructionException(e); } } } }
Example 5
Source File: ClientImpl.java From cxf with Apache License 2.0 | 5 votes |
private EndpointInfo findEndpoint(Service svc, QName port) { if (port != null) { EndpointInfo epfo = svc.getEndpointInfo(port); if (epfo == null) { throw new IllegalArgumentException("The service " + svc.getName() + " does not have an endpoint " + port + "."); } return epfo; } for (ServiceInfo svcfo : svc.getServiceInfos()) { for (EndpointInfo e : svcfo.getEndpoints()) { BindingInfo bfo = e.getBinding(); String bid = bfo.getBindingId(); if ("http://schemas.xmlsoap.org/wsdl/soap/".equals(bid) || "http://schemas.xmlsoap.org/wsdl/soap12/".equals(bid)) { for (Object o : bfo.getExtensors().get()) { try { String s = (String)o.getClass().getMethod("getTransportURI").invoke(o); if (s != null && s.endsWith("http")) { return e; } } catch (Throwable t) { //ignore } } } } } throw new UnsupportedOperationException( "Only document-style SOAP 1.1 and 1.2 http are supported " + "for auto-selection of endpoint; none were found."); }
Example 6
Source File: ServiceWSDLBuilder.java From cxf with Apache License 2.0 | 4 votes |
protected void buildService(ServiceInfo serviceInfo, Definition definition) { Map<QName, MessageInfo> messages = serviceInfo.getMessages(); for (Map.Entry<QName, MessageInfo> mie : messages.entrySet()) { if (!mie.getKey().getNamespaceURI().equals(definition.getTargetNamespace())) { continue; } if (definition.getMessage(mie.getKey()) != null) { continue; } Message message = definition.createMessage(); addDocumentation(message, mie.getValue().getMessageDocumentation()); message.setUndefined(false); message.setQName(mie.getKey()); for (MessagePartInfo mpi : mie.getValue().getMessageParts()) { Part part = definition.createPart(); boolean elemental = mpi.isElement(); // RFSB will turn on isElement bogusly. if (elemental && null == serviceInfo.getXmlSchemaCollection(). getElementByQName(mpi.getElementQName())) { elemental = false; } if (elemental) { part.setElementName(mpi.getElementQName()); } else { part.setTypeName(mpi.getTypeQName()); } part.setName(mpi.getName().getLocalPart()); message.addPart(part); } definition.addMessage(message); } addDocumentation(definition, serviceInfo.getTopLevelDoc()); Service serv = definition.createService(); addDocumentation(serv, serviceInfo.getDocumentation()); serv.setQName(serviceInfo.getName()); addNamespace(serviceInfo.getName().getNamespaceURI(), definition); addExtensibilityElements(definition, serv, getWSDL11Extensors(serviceInfo)); definition.addService(serv); for (EndpointInfo ei : serviceInfo.getEndpoints()) { addNamespace(ei.getTransportId(), definition); Port port = definition.createPort(); addDocumentation(port, ei.getDocumentation()); port.setName(ei.getName().getLocalPart()); port.setBinding(definition.getBinding(ei.getBinding().getName())); addExtensibilityElements(definition, port, getWSDL11Extensors(ei)); serv.addPort(port); } }