/** * Find all of the extensibility elements with the specified name. * * @param extensibleElement * WSDL type which extends ElementExtensible. * @param elementType * Name of the extensibility element to find. * @return List of ExtensibilityElements, may be empty. */ @SuppressWarnings( "unchecked" ) protected static List<ExtensibilityElement> findExtensibilityElements( ElementExtensible extensibleElement, String elementType ) { List<ExtensibilityElement> elements = new ArrayList<ExtensibilityElement>(); List<ExtensibilityElement> extensibilityElements = extensibleElement.getExtensibilityElements(); if ( extensibilityElements != null ) { for ( ExtensibilityElement element : extensibilityElements ) { if ( element.getElementType().getLocalPart().equalsIgnoreCase( elementType ) ) { elements.add( element ); } } } return elements; }
/** * Parse the extensibility elements in this document. */ public void parseExtensibilityElements() { for (int i = 0; i < extelements.size(); i++) { try { def.addExtensibilityElement(parseExtensibilityElement(Definition.class, (Element)extelements.get(i), def)); } catch(WSDLException e) {} } }
protected void addExtensibilityElements(Definition def, ElementExtensible elementExtensible, List<ExtensibilityElement> extensibilityElements) { if (extensibilityElements != null) { for (ExtensibilityElement element : extensibilityElements) { if (element instanceof UnknownExtensibilityElement) { UnknownExtensibilityElement uee = (UnknownExtensibilityElement)element; String pfx = uee.getElement().getPrefix(); addNamespace(pfx, element.getElementType().getNamespaceURI(), def); } else { QName qn = element.getElementType(); addNamespace(qn.getNamespaceURI(), def); } elementExtensible.addExtensibilityElement(element); } } }
/** * Find the specified extensibility element, if more than one with the specified name exists in the list, return the * first one found. * * @param extensibleElement * WSDL type which extends ElementExtensible. * @param elementType * Name of the extensiblity element to find. * @return ExtensibilityElement The ExtensiblityElement, if not found return null. */ @SuppressWarnings( "unchecked" ) protected static ExtensibilityElement findExtensibilityElement( ElementExtensible extensibleElement, String elementType ) { List<ExtensibilityElement> extensibilityElements = extensibleElement.getExtensibilityElements(); if ( extensibilityElements != null ) { for ( ExtensibilityElement element : extensibilityElements ) { if ( element.getElementType().getLocalPart().equalsIgnoreCase( elementType ) ) { return element; } } } return null; }
protected void addExtensibilityElements(Definition def, ElementExtensible elementExtensible, List<ExtensibilityElement> extensibilityElements) { if (extensibilityElements != null) { for (ExtensibilityElement element : extensibilityElements) { if (element instanceof UnknownExtensibilityElement) { UnknownExtensibilityElement uee = (UnknownExtensibilityElement)element; String pfx = uee.getElement().getPrefix(); addNamespace(pfx, element.getElementType().getNamespaceURI(), def); } else { QName qn = element.getElementType(); addNamespace(qn.getNamespaceURI(), def); } elementExtensible.addExtensibilityElement(element); } } }
private SOAPBody getSoapBody(ElementExtensible bindingInput) { List<?> extensibilityElements= bindingInput.getExtensibilityElements(); for (Object supposedSOAPBody : extensibilityElements) { if (supposedSOAPBody instanceof SOAPBody) { return ((SOAPBody) supposedSOAPBody); } } return null; }
protected void addExtensibilityElements(Definition def, ElementExtensible elementExtensible, List<ExtensibilityElement> extensibilityElements) { if (extensibilityElements != null) { for (ExtensibilityElement element : extensibilityElements) { if (element instanceof UnknownExtensibilityElement) { UnknownExtensibilityElement uee = (UnknownExtensibilityElement)element; String pfx = uee.getElement().getPrefix(); addNamespace(pfx, element.getElementType().getNamespaceURI(), def); } else { QName qn = element.getElementType(); addNamespace(qn.getNamespaceURI(), def); } elementExtensible.addExtensibilityElement(element); } } }
public static <T> T getExtension(ElementExtensible element, Class<T> format) { if (element != null) { for (Iterator it = element.getExtensibilityElements().iterator(); it.hasNext();) { Object ex = it.next(); if (format.isInstance(ex)) { return format.cast(ex); } } } return null; }
public void generatePortContent(Port port) { // We blow away any existing ExtensibilityElements/content before we generate it // Is it worth being smarter? Look for matching content first and create those which aren't found???? List removeList = new ArrayList(port.getEExtensibilityElements()); removeExtensebilityElements(port.getEExtensibilityElements(), removeList); SOAPAddress soapAddress = SOAPFactory.eINSTANCE.createSOAPAddress(); soapAddress.setLocationURI(addressLocation); port.addExtensibilityElement(soapAddress); }
public static <T> List<T> getExtensions(ElementExtensible element, Class<T> format) { List<T> l = new ArrayList<T>(); if (element != null) { for (Iterator it = element.getExtensibilityElements().iterator(); it.hasNext();) { Object ex = it.next(); if (format.isInstance(ex)) { l.add(format.cast(ex)); } } } return l; }
public void generatePortContent(Port port) { // We blow away any existing ExtensibilityElements/content before we generate it // Is it worth being smarter? Look for matching content first and create those which aren't found???? List removeList = new ArrayList(port.getEExtensibilityElements()); removeExtensebilityElements(port.getEExtensibilityElements(), removeList); HTTPAddress httpAddress = HTTPFactory.eINSTANCE.createHTTPAddress(); httpAddress.setLocationURI(addressLocation); port.addExtensibilityElement(httpAddress); }
@SuppressWarnings("unchecked") public static List<javax.wsdl.extensions.soap.SOAPHeader> getSOAPHeaders( final ElementExtensible eee) { return CollectionsX.filter(new ArrayList<javax.wsdl.extensions.soap.SOAPHeader>(), (Collection<Object>) eee.getExtensibilityElements(), javax.wsdl.extensions.soap.SOAPHeader.class); } }
public void generateBindingContent(Binding binding, PortType portType) { // We blow away any existing ExtensibilityElements/content before we generate it // Is it worth being smarter? Look for matching content first and create those which aren't found???? List removeList = new ArrayList(binding.getEExtensibilityElements()); removeExtensebilityElements(binding.getEExtensibilityElements(), removeList); HTTPBinding httpBinding = HTTPFactory.eINSTANCE.createHTTPBinding(); httpBinding.setVerb(getVerbOption(binding) == VERB_POST ? "POST" : "GET"); binding.addExtensibilityElement(httpBinding); }
/** * Method getSoapOperation. * * @param bindingOperation a binding operation. * @return a soap operation. * @throws WSIException if problems while processing. */ public static SOAPOperation getSoapOperation(BindingOperation bindingOperation) throws WSIException { if (bindingOperation.getExtensibilityElements() == null) { return null; } Iterator extensibles = bindingOperation.getExtensibilityElements().iterator(); while (extensibles.hasNext()) { Object extensible = extensibles.next(); if (extensible instanceof SOAPOperation) { return (SOAPOperation) extensible; } } return null; }
public void generateBindingOperationContent(BindingOperation bindingOperation, Operation operation) { // We blow away any existing ExtensibilityElements/content before we generate it // Is it worth being smarter? Look for matching content first and create those which aren't found???? List removeList = new ArrayList(bindingOperation.getEExtensibilityElements()); removeExtensebilityElements(bindingOperation.getEExtensibilityElements(), removeList); HTTPOperation httpOperation = HTTPFactory.eINSTANCE.createHTTPOperation(); httpOperation.setLocationURI("/" + operation.getName()); bindingOperation.addExtensibilityElement(httpOperation); }
public static <T> T getFirstExtensibilityElement(final ElementExtensible parent, final Class<T> cls) { Collection<T> ee = CollectionsX.filter(parent.getExtensibilityElements(), cls); return ee.isEmpty() ? null : ee.iterator().next(); }
public void generateBindingOperationContent(BindingOperation bindingOperation, Operation operation) { // We blow away any existing ExtensibilityElements/content before we generate it // Is it worth being smarter? Look for matching content first and create those which aren't found???? List removeList = new ArrayList(bindingOperation.getEExtensibilityElements()); removeExtensebilityElements(bindingOperation.getEExtensibilityElements(), removeList); SOAPOperation soapOperation = SOAPFactory.eINSTANCE.createSOAPOperation(); String soapActionValue = getNamespace(bindingOperation); if (!soapActionValue.endsWith("/")) { soapActionValue += "/"; } soapActionValue += operation.getName(); soapOperation.setSoapActionURI(soapActionValue); bindingOperation.addExtensibilityElement(soapOperation); }
@SuppressWarnings("unchecked") public static List<SOAPHeader> getSOAPHeaders(ElementExtensible eee) { return CollectionsX.filter(new ArrayList<SOAPHeader>(), (Collection<Object>) eee.getExtensibilityElements(), SOAPHeader.class); }
public void generateBindingInputContent(BindingInput bindingInput, Input input) { // We blow away any existing ExtensibilityElements/content before we generate it // Is it worth being smarter? Look for matching content first and create those which aren't found???? List removeList = new ArrayList(bindingInput.getEExtensibilityElements()); // hack: we're being sneaky here. Set the 'verb' options now. int option = getVerbOption(bindingInput); removeExtensebilityElements(bindingInput.getEExtensibilityElements(), removeList); if (option == VERB_POST) { // TODO: Is there an equivalent HTTP Model Object for this?.... Element element = createElement(bindingInput.getElement(), "mime", "content"); element.setAttribute("type", "application/x-www-form-urlencoded"); } else { HTTPUrlEncoded urlEncoded = HTTPFactory.eINSTANCE.createHTTPUrlEncoded(); bindingInput.addExtensibilityElement(urlEncoded); } }
private void processUnknownExtensibilityElements(ElementExtensible src, Extendable dest) throws WSDLException { List extElements = src.getExtensibilityElements(); for (int i = 0; i < extElements.size(); i++) { ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i); if (extElement instanceof UnknownExtensibilityElement) { UnknownExtensibilityElement uee = (UnknownExtensibilityElement)extElement; processNotUnderstoodExtesibilityElement(uee, dest); } } }