public static ExtensibilityElement getBindingExtension(Binding binding) { Collection bindings = new ArrayList(); CollectionsX.filter(bindings, binding.getExtensibilityElements(), HTTPBinding.class); CollectionsX.filter(bindings, binding.getExtensibilityElements(), SOAPBinding.class); CollectionsX.filter(bindings, binding.getExtensibilityElements(), SOAP12Binding.class); if (bindings.size() == 0) { return null; } else if (bindings.size() > 1) { // exception if multiple bindings found throw new IllegalArgumentException("Multiple bindings: " + binding.getQName()); } else { // retrieve the single element return (ExtensibilityElement) bindings.iterator().next(); } }
private void convertPortType(PortType portType, Binding binding) throws IOException { String comment = ""; if (portType.getDocumentationElement() != null) { comment = portType.getDocumentationElement().getNodeValue(); } Style style = Style.DOCUMENT; for (ExtensibilityElement element : (List<ExtensibilityElement>) binding.getExtensibilityElements()) { if (element instanceof SOAPBinding) { if ("rpc".equals(((SOAPBinding) element).getStyle())) { style = Style.RPC; } } else if (element instanceof HTTPBinding) { style = Style.HTTP; } } Interface iface = new Interface(portType.getQName().getLocalPart(), comment); List<Operation> operations = portType.getOperations(); for (Operation operation : operations) { if (operation.getOutput() == null) { iface.addOneWayOperation(convertOperation(operation, style)); } else { iface.addRequestResponseOperation(convertOperation(operation, style)); } } interfaces.put(iface.name(), iface); }
public static EprMetaData getBindingForTypeId(String repId, Definition wsdlDef) { LOG.log( Level.FINE, "RepositoryId " + repId + ", wsdl namespace " + wsdlDef.getTargetNamespace()); EprMetaData ret = new EprMetaData(); Collection<Binding> bindings = CastUtils.cast(wsdlDef.getBindings().values()); for (Binding b : bindings) { List<?> extElements = b.getExtensibilityElements(); // Get the list of all extensibility elements for (Iterator<?> extIter = extElements.iterator(); extIter.hasNext(); ) { java.lang.Object element = extIter.next(); // Find a binding type so we can check against its repository ID if (element instanceof BindingType) { BindingType type = (BindingType) element; if (repId.equals(type.getRepositoryID())) { ret.setCandidateWsdlDef(wsdlDef); ret.setBinding(b); return ret; } } } } if (!ret.isValid()) { // recursivly check imports Iterator<?> importLists = wsdlDef.getImports().values().iterator(); while (importLists.hasNext()) { List<?> imports = (List<?>) importLists.next(); for (java.lang.Object imp : imports) { if (imp instanceof Import) { Definition importDef = ((Import) imp).getDefinition(); LOG.log(Level.INFO, "Following import " + importDef.getDocumentBaseURI()); ret = getBindingForTypeId(repId, importDef); if (ret.isValid()) { return ret; } } } } } return ret; }
public static Binding getDefaultBinding(Object obj, Definition wsdlDef) { LOG.log(Level.FINEST, "Getting binding for a default object reference"); Collection<Binding> bindings = CastUtils.cast(wsdlDef.getBindings().values()); for (Binding b : bindings) { List<?> extElements = b.getExtensibilityElements(); // Get the list of all extensibility elements for (Iterator<?> extIter = extElements.iterator(); extIter.hasNext(); ) { java.lang.Object element = extIter.next(); // Find a binding type so we can check against its repository ID if (element instanceof BindingType) { BindingType type = (BindingType) element; if (obj._is_a(type.getRepositoryID())) { return b; } } } } return null; }