Java Code Examples for javax.wsdl.Definition#getAllServices()
The following examples show how to use
javax.wsdl.Definition#getAllServices() .
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: BPELPlanContext.java From container with Apache License 2.0 | 6 votes |
/** * Returns a List of Port which implement the given portType inside the given WSDL File * * @param portType the portType to use * @param wsdlFile the WSDL File to look in * @return a List of Port which implement the given PortType * @throws WSDLException is thrown when the given File is not a WSDL File or initializing the WSDL Factory failed */ public List<Port> getPortsInWSDLFileForPortType(final QName portType, final File wsdlFile) throws WSDLException { final List<Port> wsdlPorts = new ArrayList<>(); // taken from http://www.java.happycodings.com/Other/code24.html final WSDLFactory factory = WSDLFactory.newInstance(); final WSDLReader reader = factory.newWSDLReader(); reader.setFeature("javax.wsdl.verbose", false); final Definition wsdlInstance = reader.readWSDL(wsdlFile.getAbsolutePath()); final Map services = wsdlInstance.getAllServices(); for (final Object key : services.keySet()) { final Service service = (Service) services.get(key); final Map ports = service.getPorts(); for (final Object portKey : ports.keySet()) { final Port port = (Port) ports.get(portKey); if (port.getBinding().getPortType().getQName().getNamespaceURI().equals(portType.getNamespaceURI()) && port.getBinding().getPortType().getQName().getLocalPart().equals(portType.getLocalPart())) { wsdlPorts.add(port); } } } return wsdlPorts; }
Example 2
Source File: BPELPlanContext.java From container with Apache License 2.0 | 6 votes |
/** * Returns the Services inside the given WSDL file which implement the given portType * * @param portType the portType to search with * @param wsdlFile the WSDL file to look in * @return a List of Service which implement the given portType * @throws WSDLException is thrown when the WSDLFactory to read the WSDL can't be initialized */ private List<Service> getServicesInWSDLFile(final Path wsdlFile, final QName portType) throws WSDLException { final List<Service> servicesInWsdl = new ArrayList<>(); final WSDLFactory factory = WSDLFactory.newInstance(); final WSDLReader reader = factory.newWSDLReader(); reader.setFeature("javax.wsdl.verbose", false); final Definition wsdlInstance = reader.readWSDL(wsdlFile.toAbsolutePath().toString()); final Map services = wsdlInstance.getAllServices(); for (final Object key : services.keySet()) { final Service service = (Service) services.get(key); final Map ports = service.getPorts(); for (final Object portKey : ports.keySet()) { final Port port = (Port) ports.get(portKey); if (port.getBinding().getPortType().getQName().getNamespaceURI().equals(portType.getNamespaceURI()) && port.getBinding().getPortType().getQName().getLocalPart().equals(portType.getLocalPart())) { servicesInWsdl.add(service); } } } return servicesInWsdl; }
Example 3
Source File: WSDL11ProcessorImpl.java From carbon-apimgt with Apache License 2.0 | 6 votes |
/** * Get endpoints defined in the provided WSDL definition. * * @param definition WSDL Definition * @return a Map of endpoint names and their URIs. * @throws APIMgtWSDLException if error occurs while reading endpoints */ private Map<String, String> getEndpoints(Definition definition) throws APIMgtWSDLException { Map serviceMap = definition.getAllServices(); Iterator serviceItr = serviceMap.entrySet().iterator(); Map<String, String> serviceEndpointMap = new HashMap<>(); while (serviceItr.hasNext()) { Map.Entry svcEntry = (Map.Entry) serviceItr.next(); Service svc = (Service) svcEntry.getValue(); Map portMap = svc.getPorts(); for (Object o : portMap.entrySet()) { Map.Entry portEntry = (Map.Entry) o; Port port = (Port) portEntry.getValue(); List extensibilityElementList = port.getExtensibilityElements(); for (Object extensibilityElement : extensibilityElementList) { String addressURI = getAddressUrl(extensibilityElement); serviceEndpointMap.put(port.getName(), addressURI); } } } return serviceEndpointMap; }
Example 4
Source File: EmbeddedJMSBrokerLauncher.java From cxf with Apache License 2.0 | 5 votes |
public static void updateWsdlExtensors(Bus bus, String wsdlLocation, String url, String encodedUrl) { try { if (encodedUrl == null) { encodedUrl = url; } if (bus == null) { bus = BusFactory.getThreadDefaultBus(); } Definition def = bus.getExtension(WSDLManager.class) .getDefinition(wsdlLocation); Map<?, ?> map = def.getAllServices(); for (Object o : map.values()) { Service service = (Service)o; Map<?, ?> ports = service.getPorts(); adjustExtensibilityElements(service.getExtensibilityElements(), url, encodedUrl); for (Object p : ports.values()) { Port port = (Port)p; adjustExtensibilityElements(port.getExtensibilityElements(), url, encodedUrl); adjustExtensibilityElements(port.getBinding().getExtensibilityElements(), url, encodedUrl); } } } catch (Exception e) { e.printStackTrace(); } }