.getExtensors(ExtensibilityElement.class); if (portExtensors != null) { Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator(); QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference"); while (extensionElements.hasNext()) { ExtensibilityElement ext = extensionElements.next(); if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) { Element eprEle = ((UnknownExtensibilityElement)ext).getElement(); List<Element> addressElements = DOMUtils.getChildrenWithName(eprEle, addressElements.get(0).setTextContent(this.endpoint.getEndpointInfo().getAddress()); builder.address(this.endpoint.getEndpointInfo().getAddress()); builder.serviceName(this.endpoint.getService().getName()); builder.endpointName(this.endpoint.getEndpointInfo().getName()); if (this.endpoint.getEndpointInfo().getService().getDescription() != null) { builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService().getDescription() .getBaseURI());
for (ServiceInfo si : getService().getServiceInfos()) { for (EndpointInfo ep : si.getEndpoints()) { enames.add(ep.getName()); QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke"); for (ServiceInfo si : getService().getServiceInfos()) { si.setProperty("soap.force.doclit.bare", Boolean.TRUE); if (!isFromWsdl()) { for (EndpointInfo ei : si.getEndpoints()) { ei.setProperty("soap.no.validate.parts", Boolean.TRUE); if (o.getOutput().getMessagePartsNumber() == 0) { MessagePartInfo inf = o.getOutput().addMessagePart(o.getName()); inf.setConcreteName(new QName(o.getName().getNamespaceURI(), o.getName().getLocalPart() + "Response")); messageParts = o.getOutput().getMessageParts();
private String getNamespaceToUse(Service service) { if ("true".equals(service.get("org.apache.cxf.databinding.namespace"))) { return null; } String tns = null; if (service.getServiceInfos().size() > 0) { tns = service.getServiceInfos().get(0).getInterface().getName().getNamespaceURI(); } else { tns = service.getName().getNamespaceURI(); } return tns; }
@Override public org.apache.cxf.service.Service create() { org.apache.cxf.service.Service s = super.create(); s.put(ENDPOINT_CLASS, implInfo.getEndpointClass()); if (s.getDataBinding() != null) { setMTOMFeatures(s.getDataBinding()); } return s; }
EndpointInfo ei = null; if (portName == null) { ei = service.getServiceInfos().get(0).getEndpoints().iterator().next(); } else { ei = service.getEndpointInfo(portName); if (ei == null) { PortInfoImpl portInfo = getPortInfo(portName); if (portInfo != null && portInfo.getAddress() != null && !portInfo.getAddress().equals(ei.getAddress())) { ei.setAddress(portInfo.getAddress());
public void handleMessage(Message message) throws Fault { Fault f = (Fault)message.getContent(Exception.class); if (f == null) { return; SoapVersion soapVersion = (SoapVersion)message.get(SoapVersion.class.getName()); if (soapVersion != null && soapVersion.getVersion() != 1.1) { if (f instanceof SoapFault) { message.setContent(Exception.class, f); throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_INVOKE", BUNDLE), e); Service service = message.getExchange().getService(); = service.getDataBinding().createWriter(XMLStreamWriter.class); Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0), message.getExchange().getBus()); writer.setSchema(schema); OperationInfo op = message.getExchange().getBindingOperationInfo().getOperationInfo(); QName faultName = getFaultName(fault, cause.getClass(), op); MessagePartInfo part = getFaultMessagePart(faultName, op);
protected BindingOperationInfo getBindingOperationFromEndpoint(Endpoint ep, final String operationName) { QName q = new QName(ep.getService().getName().getNamespaceURI(), operationName); BindingOperationInfo bop = ep.getBinding().getBindingInfo().getOperation(q); return bop; }
private void initializePorts() { try { Definition def = bus.getExtension(WSDLManager.class).getDefinition(wsdlURL); javax.wsdl.Service serv = def.getService(serviceName); if (serv == null) { QName name = new QName(serviceName.getNamespaceURI(), port.getName()); for (ServiceInfo si : service.getServiceInfos()) { for (EndpointInfo ei : si.getEndpoints()) { String bindingID = BindingID.getJaxwsBindingID(ei.getTransportId()); addPort(ei.getName(), bindingID, ei.getAddress());
StringBuilder getBaseServiceName(Endpoint endpoint, boolean isClient, String clientId) { StringBuilder buffer = new StringBuilder(); if (endpoint.get("org.apache.cxf.management.service.counter.name") != null) { buffer.append((String)endpoint.get("org.apache.cxf.management.service.counter.name")); } else { Service service = endpoint.getService(); String serviceName = "\"" + escapePatternChars(service.getName().toString()) + "\""; String portName = "\"" + endpoint.getEndpointInfo().getName().getLocalPart() + "\""; buffer.append(ManagementConstants.DEFAULT_DOMAIN_NAME + ":"); buffer.append(ManagementConstants.BUS_ID_PROP + "=" + bus.getId() + ","); buffer.append(ManagementConstants.TYPE_PROP).append("=Metrics"); if (isClient) { buffer.append(".Client,"); } else { buffer.append(".Server,"); } buffer.append(ManagementConstants.SERVICE_NAME_PROP + "=" + serviceName + ","); buffer.append(ManagementConstants.PORT_NAME_PROP + "=" + portName + ","); if (clientId != null) { buffer.append("Client=" + clientId + ","); } } return buffer; }
private void addPolicies(AbstractServiceFactoryBean factory, Endpoint endpoint, Class<?> cls, List<Policy> list, Policy.Placement defaultPlace) { ListIterator<Policy> it = list.listIterator(); InterfaceInfo inf = endpoint.getEndpointInfo().getInterface(); BindingInfo binf = endpoint.getBinding().getBindingInfo(); ServiceInfo si = endpoint.getService().getServiceInfos().get(0); while (it.hasNext()) { Policy p = it.next(); case PORT_TYPE: { addPolicy(inf, si, p, cls, inf.getName().getLocalPart() + "PortTypePolicy"); it.remove(); break; binf.getName().getLocalPart() + "BindingPolicy"); it.remove(); break; si.getName().getLocalPart() + "ServicePolicy"); it.remove(); break; addPolicy(endpoint.getEndpointInfo(), si, p, cls, endpoint.getEndpointInfo().getName().getLocalPart() + "PortPolicy"); it.remove(); break;
public Server getServerForService(QName serviceName) throws WSDLException { ServerRegistry svrMan = bus.getExtension(ServerRegistry.class); for (Server s : svrMan.getServers()) { Service svc = s.getEndpoint().getService(); if (svc.getName().equals(serviceName)) { return s; } } return null; }
Endpoint endpoint = exchange.getEndpoint(); Collection<ServiceInfo> services = endpoint.getService().getServiceInfos(); 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)) {
public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo boi = ex.getBindingOperationInfo(); if (Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE)) || boi == null) { return; Method method = ex.get(Method.class); BindingMessageInfo bmi; MessageInfo wrappedMessageInfo = message.get(MessageInfo.class); MessageInfo messageInfo; if (wrappedMessageInfo == boi.getOperationInfo().getInput()) { message.put(MessageInfo.class, messageInfo); message.put(BindingMessageInfo.class, bmi); ex.put(BindingOperationInfo.class, boi2); if (helper == null) { Service service = ServiceModelUtil.getService(message.getExchange()); DataBinding dataBinding = service.getDataBinding(); if (dataBinding instanceof WrapperCapableDatabinding) { helper = createWrapperHelper((WrapperCapableDatabinding)dataBinding, MessagePartInfo mpi = null; for (MessagePartInfo mpi2 : wrappedMessageInfo.getMessageParts()) { if (mpi2.getConcreteName().equals(part.getConcreteName())) { mpi = mpi2;
protected InterfaceInfo getInterfaceInfo() { if (getEndpointInfo() != null) { return getEndpointInfo().getInterface(); } QName qn = this.getInterfaceName(); for (ServiceInfo si : getService().getServiceInfos()) { if (qn.equals(si.getInterface().getName())) { return si.getInterface(); } } throw new ServiceConstructionException(new Message("COULD_NOT_FIND_PORTTYPE", LOG, qn)); }
public void startServer(Server serv) { if (serv.getEndpoint().getBinding() instanceof SoapBinding) { QName qn = serv.getEndpoint().getService().getName(); if (!"http://mex.ws.cxf.apache.org/".equals(qn.getNamespaceURI())) { serv.getEndpoint().getInInterceptors().add(new MEXInInterceptor(serv)); } } }
/** * Obtain handler chain from annotations. * @param server * */ private void buildHandlerChain(Server server) { AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder(); @SuppressWarnings("rawtypes") List<Handler> chain = new ArrayList<>(handlers); chain.addAll(builder.buildHandlerChainFromClass(getServiceBeanClass(), server.getEndpoint().getEndpointInfo().getName(), server.getEndpoint().getService().getName(), this.getBindingId())); for (Handler<?> h : chain) { injectResources(h); } ((JaxWsEndpointImpl)server.getEndpoint()).getJaxwsBinding().setHandlerChain(chain); }
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; }
public RMEndpoint findReliableEndpoint(QName qn) { for (RMEndpoint rpe : reliableEndpoints.values()) { if (qn.equals(rpe.getApplicationEndpoint().getService().getName())) { return rpe; } } return null; }
public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); Set<Endpoint> endpoints = CastUtils.cast((Set<?>)ex.get(MultipleEndpointObserver.ENDPOINTS)); Endpoint ep = selectEndpoint(message, endpoints); if (ep == null) { return; } ex.put(Endpoint.class, ep); ex.put(Binding.class, ep.getBinding()); ex.put(Service.class, ep.getService()); InterceptorChain chain = message.getInterceptorChain(); chain.add(ep.getInInterceptors()); chain.add(ep.getBinding().getInInterceptors()); chain.add(ep.getService().getInInterceptors()); chain.setFaultObserver(ep.getOutFaultObserver()); }
public EndpointReference getEndpointReference(final Element... referenceParameters) { final org.apache.cxf.message.Message msg = getWrappedMessage(); final Endpoint ep = msg.getExchange().get(Endpoint.class); final W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); builder.address(ep.getEndpointInfo().getAddress()); builder.serviceName(ep.getService().getName()); builder.endpointName(ep.getEndpointInfo().getName()); if (referenceParameters != null) { for (final Element referenceParameter : referenceParameters) { builder.referenceParameter(referenceParameter); } } return builder.build(); }