public InterfaceType getInterface() throws WSDLException { InterfaceType res = null; InterfaceType item = null; for (final Endpoint ep : this.getEndpoints()) { item = ep.getBinding().getInterface(); if (item != null) { res = item; } if (item != res) { throw new WSDLException("The endpoints of this service do not implement the same interface"); } } return res; }
/** * Get the endpoints of a given WSDL Description * * @param description * @return */ public static final List<ServiceEndpoint> getEndpoints(Description description) { List<ServiceEndpoint> result = new ArrayList<ServiceEndpoint>(); List<Service> services = description.getServices(); for (Service service : services) { QName serviceName = service.getQName(); List<Endpoint> endpoints = service.getEndpoints(); for (Endpoint endpoint : endpoints) { ServiceEndpoint serviceEndpoint = new ServiceEndpoint(); serviceEndpoint.setEndpoint(endpoint.getName()); serviceEndpoint.setItf(new QName(endpoint.getBinding().getInterface().getQName() .getNamespaceURI(), endpoint.getBinding().getInterface().getQName() .getLocalPart())); serviceEndpoint.setService(new QName(serviceName.getNamespaceURI(), serviceName .getLocalPart())); result.add(serviceEndpoint); } } return result; }
/** * TODO Copied from ServiceEndpointHelper from petals-message-exchange, it should be moved to easywsdl normally! */ private static @Nullable InterfaceType getInterfaceFromService(final QName serviceName, final String endpointName, final Description description, final Logger logger) throws WSDLException { final Service ss = description.getService(serviceName); if (ss != null) { final Endpoint endpoint = ss.getEndpoint(endpointName); if (endpoint != null) { final Binding binding = endpoint.getBinding(); if (binding != null && binding.getInterface() != null) { return binding.getInterface(); } else { logger.config("No valid binding for endpoint '" + endpointName + "' in component description for service '" + serviceName + "', using service's interface"); return ss.getInterface(); } } else { logger.config("No endpoint '" + endpointName + "' in component description for service '" + serviceName + "', using service's interface"); return ss.getInterface(); } } else { logger.config("No service '" + serviceName + "' in component description"); return null; } } }
/** * in WSDL2, the service has an interface defined, but in WSDL1, we are not totally assured that getting interface * on the service will succeed, so it is safer to check directly the binding. We fallback on the service's interface * else. */ private static InterfaceType getInterfaceFromService(final QName serviceName, final String endpointName, final Description description, final Logger logger) throws WSDLException { final Service ss = description.getService(serviceName); if (ss != null) { final Endpoint endpoint = ss.getEndpoint(endpointName); if (endpoint != null) { final Binding binding = endpoint.getBinding(); if (binding != null && binding.getInterface() != null) { return binding.getInterface(); } else { logger.config("No valid binding for endpoint '" + endpointName + "' in component description for service '" + serviceName + "', using service's interface"); return ss.getInterface(); } } else { logger.config("No endpoint '" + endpointName + "' in component description for service '" + serviceName + "', using service's interface"); return ss.getInterface(); } } else { logger.config("No service '" + serviceName + "' in component description"); return null; } }
int endpointIndex = -1; for (Endpoint endpoint : endpoints) { Binding binding = endpoint.getBinding(); endpointIndex = endpointIndex + 1;
private String retrieveSoapActionFromWsdl(final Exchange exchange, final ServiceContext<Provides> context) { String soapAction = null; final String endpointName = exchange.getEndpointName(); final QName service = exchange.getEndpoint().getServiceName(); final Description d = context.getServiceDescription(); final Endpoint e = d.getService(service).getEndpoint(endpointName); if (e != null) { final Binding b = e.getBinding(); if (b != null) { final BindingOperation bo = b.getBindingOperation(exchange.getOperationName()); if (bo != null) { soapAction = bo.getSoapAction(); // See PETALSBCSOAP-151 if (soapAction == null || soapAction.isEmpty()) { // it must contain the characters for an empty string, if not // org.apache.axis2.transport.http.CommonsHTTPTransportSender.findSOAPAction(MessageContext) // won't be happy with it! soapAction = "\"\""; } } } } return soapAction; } }
final InterfaceType itf = endpoint.getBinding().getInterface(); final Operation op = itf.getOperation(new QName(itf.getQName().getNamespaceURI(), message.getOperationName())); if(op == null) {
final Binding binding = endpoint.getBinding(); if(binding == null) { throw new WSDMException("Binding not found");
final Binding binding = endpoint.getBinding();