Java Code Examples for org.apache.cxf.service.model.EndpointInfo#getService()
The following examples show how to use
org.apache.cxf.service.model.EndpointInfo#getService() .
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: WSDLGetUtils.java From cxf with Apache License 2.0 | 6 votes |
/** * Create a wsdl Definition object from the endpoint information and register * it in the local data structure for future reference. * * @param bus CXF's hub for access to internal constructs * @param mp a map of known wsdl Definition objects * @param message * @param smp a map of known xsd SchemaReference objects * @param base the request URL * @param endpointInfo information for a web service 'port' inside of a service * @throws WSDLException */ protected void updateWSDLKeyDefinition(Bus bus, Map<String, Definition> mp, Message message, Map<String, SchemaReference> smp, String base, EndpointInfo endpointInfo) throws WSDLException { if (!mp.containsKey("")) { ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, endpointInfo.getService()); builder.setUseSchemaImports( MessageUtils.getContextualBoolean(message, WSDL_CREATE_IMPORTS, false)); // base file name is ignored if createSchemaImports == false! builder.setBaseFileName(endpointInfo.getService().getName().getLocalPart()); Definition def = builder.build(new HashMap<String, SchemaInfo>()); mp.put("", def); updateDefinition(bus, def, mp, smp, base, "", ""); } }
Example 2
Source File: MAPAggregatorImpl.java From cxf with Apache License 2.0 | 6 votes |
/** * Determine if the use of addressing is indicated by the presence of a * the usingAddressing attribute. * * @param message the current message * @pre message is outbound * @pre requestor role */ private boolean hasUsingAddressing(Message message) { boolean ret = false; Endpoint endpoint = message.getExchange().getEndpoint(); if (null != endpoint) { Boolean b = (Boolean)endpoint.get(USING_ADDRESSING); if (null == b) { EndpointInfo endpointInfo = endpoint.getEndpointInfo(); List<ExtensibilityElement> endpointExts = endpointInfo != null ? endpointInfo .getExtensors(ExtensibilityElement.class) : null; List<ExtensibilityElement> bindingExts = endpointInfo != null && endpointInfo.getBinding() != null ? endpointInfo .getBinding().getExtensors(ExtensibilityElement.class) : null; List<ExtensibilityElement> serviceExts = endpointInfo != null && endpointInfo.getService() != null ? endpointInfo .getService().getExtensors(ExtensibilityElement.class) : null; ret = hasUsingAddressing(endpointExts) || hasUsingAddressing(bindingExts) || hasUsingAddressing(serviceExts); b = ret ? Boolean.TRUE : Boolean.FALSE; endpoint.put(USING_ADDRESSING, b); } else { ret = b.booleanValue(); } } return ret; }
Example 3
Source File: RMEndpoint.java From cxf with Apache License 2.0 | 6 votes |
Object getUsingAddressing(EndpointInfo endpointInfo) { if (null == endpointInfo) { return null; } Object ua = null; List<ExtensibilityElement> exts = endpointInfo.getExtensors(ExtensibilityElement.class); ua = getUsingAddressing(exts); if (null != ua) { return ua; } exts = endpointInfo.getBinding() != null ? endpointInfo.getBinding() .getExtensors(ExtensibilityElement.class) : null; ua = getUsingAddressing(exts); if (null != ua) { return ua; } exts = endpointInfo.getService() != null ? endpointInfo.getService() .getExtensors(ExtensibilityElement.class) : null; ua = getUsingAddressing(exts); if (null != ua) { return ua; } return ua; }
Example 4
Source File: CorbaDestination.java From cxf with Apache License 2.0 | 6 votes |
public EndpointReferenceType getAddressWithId(String id) { EndpointReferenceType ref = null; if (bindingPOA == null) { throw new CorbaBindingException( "getAddressWithId failed because the poa is null"); } try { Servant servant = bindingPOA.id_to_servant(objectId); org.omg.CORBA.Object objRef = bindingPOA.create_reference_with_id(id.getBytes(), servant._all_interfaces(bindingPOA, objectId)[0]); AddressType addr = new AddressType(); orbConfig.exportObjectReference(orb, objRef, address.getLocation(), addr); ref = EndpointReferenceUtils.getEndpointReference(addr.getLocation()); EndpointInfo ei = getEndPointInfo(); if (ei.getService() != null) { EndpointReferenceUtils.setServiceAndPortName(ref, ei.getService().getName(), ei.getName().getLocalPart()); } } catch (Exception e) { throw new CorbaBindingException("Failed to getAddressWithId, reason:" + e.toString(), e); } return ref; }
Example 5
Source File: JMSEndpointWSDLUtil.java From cxf with Apache License 2.0 | 6 votes |
public static <T> T getWSDLExtensor(EndpointInfo ei, Class<T> cls) { ServiceInfo si = ei.getService(); BindingInfo bi = ei.getBinding(); Object o = ei.getExtensor(cls); if (o == null && si != null) { o = si.getExtensor(cls); } if (o == null && bi != null) { o = bi.getExtensor(cls); } if (o == null) { return null; } if (cls.isInstance(o)) { return cls.cast(o); } return null; }
Example 6
Source File: AbstractLoggingInterceptor.java From cxf with Apache License 2.0 | 6 votes |
Logger getMessageLogger(Message message) { if (isLoggingDisabledNow(message)) { return null; } Endpoint ep = message.getExchange().getEndpoint(); if (ep == null || ep.getEndpointInfo() == null) { return getLogger(); } EndpointInfo endpoint = ep.getEndpointInfo(); if (endpoint.getService() == null) { return getLogger(); } Logger logger = endpoint.getProperty("MessageLogger", Logger.class); if (logger == null) { String serviceName = endpoint.getService().getName().getLocalPart(); InterfaceInfo iface = endpoint.getService().getInterface(); String portName = endpoint.getName().getLocalPart(); String portTypeName = iface.getName().getLocalPart(); String logName = "org.apache.cxf.services." + serviceName + "." + portName + "." + portTypeName; logger = LogUtils.getL7dLogger(this.getClass(), null, logName); endpoint.setProperty("MessageLogger", logger); } return logger; }
Example 7
Source File: URIDomainExpression.java From cxf with Apache License 2.0 | 5 votes |
@Override public boolean appliesTo(EndpointInfo ei) { if (ei == null) { return false; } return (ei.getService() != null) && (ei.getService().getName() != null) && (ei.getName() != null) && wsdl11XPointer.matchesPort(ei.getService().getTargetNamespace(), ei.getService().getName().getLocalPart(), ei.getName().getLocalPart()); }
Example 8
Source File: MAPAggregatorTest.java From cxf with Apache License 2.0 | 5 votes |
private void setUpUsingAddressing(Message message, Exchange exchange, boolean usingAddressing) { setUpMessageExchange(message, exchange); Endpoint endpoint = control.createMock(Endpoint.class); endpoint.getOutInterceptors(); EasyMock.expectLastCall().andReturn(new ArrayList<Interceptor<? extends Message>>()).anyTimes(); setUpExchangeGet(exchange, Endpoint.class, endpoint); EndpointInfo endpointInfo = control.createMock(EndpointInfo.class); endpoint.getEndpointInfo(); EasyMock.expectLastCall().andReturn(endpointInfo).anyTimes(); List<ExtensibilityElement> endpointExts = new ArrayList<>(); endpointInfo.getExtensors(EasyMock.eq(ExtensibilityElement.class)); EasyMock.expectLastCall().andReturn(endpointExts).anyTimes(); BindingInfo bindingInfo = control.createMock(BindingInfo.class); endpointInfo.getBinding(); EasyMock.expectLastCall().andReturn(bindingInfo).anyTimes(); bindingInfo.getExtensors(EasyMock.eq(ExtensibilityElement.class)); EasyMock.expectLastCall().andReturn(Collections.EMPTY_LIST).anyTimes(); ServiceInfo serviceInfo = control.createMock(ServiceInfo.class); endpointInfo.getService(); EasyMock.expectLastCall().andReturn(serviceInfo).anyTimes(); serviceInfo.getExtensors(EasyMock.eq(ExtensibilityElement.class)); EasyMock.expectLastCall().andReturn(Collections.EMPTY_LIST).anyTimes(); ExtensibilityElement ext = control.createMock(ExtensibilityElement.class); if (usingAddressing) { QName elementType = usingAddressing ? Names.WSAW_USING_ADDRESSING_QNAME : new QName(SOAP_NAMESPACE, "encodingStyle"); ext.getElementType(); EasyMock.expectLastCall().andReturn(elementType).anyTimes(); endpointExts.add(ext); } }
Example 9
Source File: DefaultLogEventMapper.java From cxf with Apache License 2.0 | 5 votes |
public void setEpInfo(Message message, final LogEvent event) { EndpointInfo endpoint = getEPInfo(message); event.setPortName(endpoint.getName()); event.setPortTypeName(endpoint.getName()); String opName = isSOAPMessage(message) ? getOperationName(message) : getRestOperationName(message); event.setOperationName(opName); if (endpoint.getService() != null) { setServiceInfo(endpoint.getService(), event); } }
Example 10
Source File: TestBase.java From cxf with Apache License 2.0 | 5 votes |
protected void common(String wsdl, QName portName, Class<?>... jaxbClasses) throws Exception { Bus bus = BusFactory.getDefaultBus(); WSDLManagerImpl manager = new WSDLManagerImpl(); XMLWSDLExtensionLoader.registerExtensors(manager); assertNotNull(bus.getExtension(WSDLManager.class)); WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource(wsdl).toString(), new QName(portName.getNamespaceURI(), "XMLService")); org.apache.cxf.service.Service service = factory.create(); EndpointInfo epi = service.getEndpointInfo(portName); assertNotNull(epi); serviceInfo = epi.getService(); JAXBDataBinding db = new JAXBDataBinding(); db.initialize(service); db.setContext(JAXBContext.newInstance(jaxbClasses)); service.setDataBinding(db); Endpoint endpoint = new EndpointImpl(bus, service, epi); xmlMessage.getExchange().put(Endpoint.class, endpoint); xmlMessage.getExchange().put(org.apache.cxf.service.Service.class, service); }