Java Code Examples for javax.wsdl.Binding#getBindingOperations()
The following examples show how to use
javax.wsdl.Binding#getBindingOperations() .
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: ManagementBusInvocationPluginSoapHttp.java From container with Apache License 2.0 | 6 votes |
private BindingOperation findOperation(final Definition wsdl, final String operationName) { if (wsdl == null) { return null; } Map<QName, ?> bindings = wsdl.getBindings(); for (Map.Entry<QName, ?> entry : bindings.entrySet()) { Binding binding = wsdl.getBinding((QName) entry.getKey()); List<BindingOperation> definedOperations = binding.getBindingOperations(); for (BindingOperation operation : definedOperations) { if (operation.getName().equalsIgnoreCase(operationName)) { return operation; } } } return null; }
Example 2
Source File: WSDL11SOAPOperationExtractor.java From carbon-apimgt with Apache License 2.0 | 6 votes |
/** * Retrieves all the operations defined in the provided Binding. * * @param binding WSDL binding * @return a set of {@link WSDLOperation} defined in the provided Binding */ private Set<WSDLSOAPOperation> getSOAPBindingOperations(Binding binding) throws APIMgtWSDLException { Set<WSDLSOAPOperation> allBindingOperations = new HashSet<>(); if (binding.getExtensibilityElements() != null && binding.getExtensibilityElements().size() > 0) { List extensibilityElements = binding.getExtensibilityElements(); for (Object extensibilityElement : extensibilityElements) { if (extensibilityElement instanceof SOAPBinding || extensibilityElement instanceof SOAP12Binding) { for (Object opObj : binding.getBindingOperations()) { BindingOperation bindingOperation = (BindingOperation) opObj; WSDLSOAPOperation wsdlSoapOperation = getSOAPOperation(bindingOperation); if (wsdlSoapOperation != null) { allBindingOperations.add(wsdlSoapOperation); } else { log.warn("Unable to get soap operation details from binding operation: " + bindingOperation .getName()); } } } } } else { throw new APIMgtWSDLException("Cannot further process to get soap binding operations"); } return allBindingOperations; }
Example 3
Source File: WSDLUtils.java From tesb-studio-se with Apache License 2.0 | 5 votes |
public static boolean isOperationInBinding(Definition definition, String portTypeName, String operationName) throws CoreException { Collection<?> services = definition.getServices().values(); for (Object s : services) { Service service = (Service) s; Collection<?> ports = service.getPorts().values(); for (Object p : ports) { Port port = (Port) p; Binding binding = port.getBinding(); if (binding == null) { continue; } PortType portType = binding.getPortType(); if (portType == null || !portTypeName.equals(portType.getQName().getLocalPart())) { continue; } List<?> bindingOperations = binding.getBindingOperations(); for (Object o : bindingOperations) { BindingOperation bo = (BindingOperation) o; if (operationName.equals(bo.getName())) { return true; } } } } return false; }
Example 4
Source File: PublishMetadataRunnable.java From tesb-studio-se with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private Collection<String> getAllPaths() throws URISyntaxException { final Set<String> paths = new HashSet<String>(); final Set<QName> portTypes = new HashSet<QName>(); final Set<QName> alreadyCreated = new HashSet<QName>(); for (Binding binding : (Collection<Binding>) wsdlDefinition.getAllBindings().values()) { final QName portType = binding.getPortType().getQName(); if (portTypes.add(portType)) { for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) { Operation oper = operation.getOperation(); Input inDef = oper.getInput(); if (inDef != null) { Message inMsg = inDef.getMessage(); addParamsToPath(portType, oper, inMsg, paths, alreadyCreated); } Output outDef = oper.getOutput(); if (outDef != null) { Message outMsg = outDef.getMessage(); addParamsToPath(portType, oper, outMsg, paths, alreadyCreated); } for (Fault fault : (Collection<Fault>) oper.getFaults().values()) { Message faultMsg = fault.getMessage(); addParamsToPath(portType, oper, faultMsg, paths, alreadyCreated); } } } } return paths; }
Example 5
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
public static String getCanonicalBindingStyle(Binding binding) { String bindingStyle = getBindingStyle(binding); if (!StringUtils.isEmpty(bindingStyle)) { return bindingStyle; } for (Object bobj : binding.getBindingOperations()) { BindingOperation bindingOp = (BindingOperation)bobj; String bopStyle = getSOAPOperationStyle(bindingOp); if (!StringUtils.isEmpty(bopStyle)) { return bopStyle; } } return ""; }
Example 6
Source File: SOAPBindingUtil.java From cxf with Apache License 2.0 | 5 votes |
public static String getCanonicalBindingStyle(Binding binding) { String bindingStyle = getBindingStyle(binding); if (!StringUtils.isEmpty(bindingStyle)) { return bindingStyle; } for (Object bobj : binding.getBindingOperations()) { BindingOperation bindingOp = (BindingOperation)bobj; String bopStyle = getSOAPOperationStyle(bindingOp); if (!StringUtils.isEmpty(bopStyle)) { return bopStyle; } } return ""; }
Example 7
Source File: ComponentBuilder.java From tesb-studio-se with Apache License 2.0 | 4 votes |
private static ServiceInfo populateComponent(Service service) { ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setServiceName(service.getQName()); Collection<Port> ports = service.getPorts().values(); for (Port port : ports) { String soapLocation = null; SOAPAddress soapAddress = findExtensibilityElement(port.getExtensibilityElements(), SOAPAddress.class); if (null != soapAddress) { soapLocation = soapAddress.getLocationURI(); } else { SOAP12Address soap12Address = findExtensibilityElement(port.getExtensibilityElements(), SOAP12Address.class); if (null != soap12Address) { soapLocation = soap12Address.getLocationURI(); } } Binding binding = port.getBinding(); for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) { SOAPOperation soapOperation = findExtensibilityElement(operation.getExtensibilityElements(), SOAPOperation.class); if (null != soapOperation && OPERATION_TYPE_RPC.equalsIgnoreCase(soapOperation.getStyle())) { // TESB-6151 disable display of unsupported RPC type. serviceInfo.setHasRpcOperation(true); continue; } OperationInfo operationInfo = new OperationInfo(operation.getOperation()); operationInfo.setPortName(port.getName()); operationInfo.setNamespaceURI(binding.getPortType().getQName().getNamespaceURI()); if (soapOperation != null) { operationInfo.setSoapActionURI(soapOperation.getSoapActionURI()); } else { SOAP12Operation soap12Operation = findExtensibilityElement(operation.getExtensibilityElements(), SOAP12Operation.class); if (soap12Operation != null) { operationInfo.setSoapActionURI(soap12Operation.getSoapActionURI()); } } operationInfo.setTargetURL(soapLocation); serviceInfo.addOperation(operationInfo); } } return serviceInfo; }
Example 8
Source File: WsdlScenarioGenerator.java From citrus-simulator with Apache License 2.0 | 4 votes |
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { Assert.notNull(wsdlResource, "Missing either WSDL location system property setting or explicit WSDL resource for scenario auto generation"); Definition wsdl = getWsdlDefinition(wsdlResource); XmlObject wsdlObject = compileWsdl(wsdlResource); SchemaTypeSystem schemaTypeSystem = compileXsd(wsdlObject); for (Object item : wsdl.getBindings().values()) { Binding binding = (Binding) item; for (Object operationItem : binding.getBindingOperations()) { BindingOperation operation = (BindingOperation) operationItem; SchemaType requestElem = getSchemaType(schemaTypeSystem, operation.getName(), operation.getOperation().getInput().getName()); SchemaType responseElem = getSchemaType(schemaTypeSystem, operation.getName(), operation.getOperation().getOutput().getName()); String soapAction = ""; List extensions = operation.getExtensibilityElements(); if (extensions != null) { for (int i = 0; i < extensions.size(); i++) { ExtensibilityElement extElement = (ExtensibilityElement) extensions.get(i); if (extElement instanceof SOAPOperation) { SOAPOperation soapOp = (SOAPOperation) extElement; soapAction = soapOp.getSoapActionURI(); } } } String scenarioName; switch (namingStrategy) { case INPUT: scenarioName = operation.getOperation().getInput().getName(); break; case OPERATION: scenarioName = operation.getOperation().getName(); break; case SOAP_ACTION: scenarioName = soapAction; break; default: throw new SimulatorException("Unknown scenario naming strategy"); } if (beanFactory instanceof BeanDefinitionRegistry) { log.info("Register auto generated scenario as bean definition: " + scenarioName); BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(WsdlOperationScenario.class) .addConstructorArgValue(operation) .addPropertyValue("soapAction", soapAction) .addPropertyValue("input", generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem))) .addPropertyValue("output", generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem))); if (beanFactory.containsBeanDefinition("inboundXmlDataDictionary")) { beanDefinitionBuilder.addPropertyReference("inboundDataDictionary", "inboundXmlDataDictionary"); } if (beanFactory.containsBeanDefinition("outboundXmlDataDictionary")) { beanDefinitionBuilder.addPropertyReference("outboundDataDictionary", "outboundXmlDataDictionary"); } ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition(scenarioName, beanDefinitionBuilder.getBeanDefinition()); } else { log.info("Register auto generated scenario as singleton: " + scenarioName); WsdlOperationScenario scenario = createScenario(operation, soapAction, generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)), generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem))); beanFactory.registerSingleton(scenarioName, scenario); } } } }
Example 9
Source File: WsdlVisitor.java From tomee with Apache License 2.0 | 4 votes |
public void walkTree() { begin(); try { visit(definition); for (Iterator iterator = definition.getImports().entrySet().iterator(); iterator.hasNext(); ) { Map.Entry entry = (Map.Entry) iterator.next(); String namespaceURI = (String) entry.getKey(); List importsForNamespace = (List) entry.getValue(); for (Iterator iterator1 = importsForNamespace.iterator(); iterator1.hasNext(); ) { Import anImport = (Import) iterator1.next(); visit(anImport); } } visit(definition.getTypes()); Collection messages = definition.getMessages().values(); for (Iterator iterator = messages.iterator(); iterator.hasNext(); ) { Message message = (Message) iterator.next(); visit(message); Collection parts = message.getParts().values(); for (Iterator iterator2 = parts.iterator(); iterator2.hasNext(); ) { Part part = (Part) iterator2.next(); visit(part); } } Collection services = definition.getServices().values(); for (Iterator iterator = services.iterator(); iterator.hasNext(); ) { Service service = (Service) iterator.next(); visit(service); Collection ports = service.getPorts().values(); for (Iterator iterator1 = ports.iterator(); iterator1.hasNext(); ) { Port port = (Port) iterator1.next(); visit(port); Binding binding = port.getBinding(); visit(binding); List bindingOperations = binding.getBindingOperations(); for (int i = 0; i < bindingOperations.size(); i++) { BindingOperation bindingOperation = (BindingOperation) bindingOperations.get(i); visit(bindingOperation); visit(bindingOperation.getBindingInput()); visit(bindingOperation.getBindingOutput()); Collection bindingFaults = bindingOperation.getBindingFaults().values(); for (Iterator iterator2 = bindingFaults.iterator(); iterator2.hasNext(); ) { BindingFault bindingFault = (BindingFault) iterator2.next(); visit(bindingFault); } } PortType portType = binding.getPortType(); visit(portType); List operations = portType.getOperations(); for (int i = 0; i < operations.size(); i++) { Operation operation = (Operation) operations.get(i); visit(operation); { Input input = operation.getInput(); visit(input); } { Output output = operation.getOutput(); visit(output); } Collection faults = operation.getFaults().values(); for (Iterator iterator2 = faults.iterator(); iterator2.hasNext(); ) { Fault fault = (Fault) iterator2.next(); visit(fault); } } } } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } finally { end(); } }