/** * @param uri * @return The URI with "?wsdl" at the end. */ public static String appendWSDLQuary(String uri) { URI wsdlURI = appendWSDLQuary(URI.create(uri)); return wsdlURI.toString(); }
private void transformServiceWsdls(Map<String, WsdlDefinitions> wsdls, URI dscUrl) { Set<String> keys = wsdls.keySet(); for (String string : keys) { WsdlDefinitions wsdl = wsdls.get(string); // Replacing the gfac xsd remote urls // this was done because avoid network inaccisibilities WSDLUtil.replaceAttributeValue(wsdl.getTypes(), "schemaLocation", "http://www.extreme.indiana.edu/gfac/gfac-simple-types.xsd", "gfac-simple-types.xsd"); addBindings(wsdl, dscUrl); addImportsAndHeaderMessage(wsdl); } }
/** * @param definitions3 * @return The WsdlDefinitions (XSUL5) */ @Deprecated public static xsul5.wsdl.WsdlDefinitions wsdlDefinitions3ToWsdlDefintions5(xsul.wsdl.WsdlDefinitions definitions3) { return WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions3); }
/** * @param definitions * @param paramType * @return The type definition */ public static XmlElement getTypeDefinition(WsdlDefinitions definitions, QName paramType) throws UtilsException { XmlElement types = definitions.getTypes(); XmlElement returnType = null; types.element(null, WSConstants.SCHEMA_TAG); Iterable<XmlElement> schemas = types.elements(null, WSConstants.SCHEMA_TAG); for (XmlElement schema : schemas) { returnType = findTypeInSchema(paramType, schema); if (returnType != null) { return returnType; } } // ok we didnt find the type in the schemas // try to find it in the schema imports. // if not found it will return null so we would return null return findTypeDefinitionInImports(definitions, paramType); }
typeDefinition = WSDLUtil.getTypeDefinition(this.definitions, paramType); typeDefinition = WSDLUtil.findTypeDefinitionInImports(serviceWSDL, paramType); if (typeDefinition != null) { XmlElement importEle = WSDLUtil.getImportContainingTypeDefinition(serviceWSDL, paramType); addImportIfNecessary(importEle); String prefix = declareNamespaceIfNecessary(paramType.getPrefix(), paramType.getNamespaceURI(), XmlElement newSchema = WSDLUtil.getSchema(serviceWSDL, paramType); if (newSchema == null) { + WSDLUtil.getWSDLQName(serviceWSDL));
public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL, String messageBoxURL, WorkflowContextHeaderBuilder builder, boolean differ) throws WorkflowException { Invoker invoker = null; if (definitions != null && definitions.getServices().iterator().hasNext()) { // check if this web service supports asynchronous invocation if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) { invoker = new AsynchronousInvoker(definitions, messageBoxURL); } else { invoker = new SimpleInvoker(definitions); } } else if (gfacURL != null && gfacURL.length() != 0) { invoker = new GFacInvoker(portTypeQName, gfacURL, messageBoxURL, builder); } if (invoker == null) { String message = "Cannot find an appropriate way to invoke the service"; throw new WorkflowException(message); } return invoker; } }
public static boolean attributeExist(XmlElement element, String name, String value) { XmlAttribute attribute = element.attribute(name); if (null != attribute && value.equals(attribute.getValue())) { return true; } Iterable iterator = element.children(); boolean ret = false; for (Object object : iterator) { if (object instanceof XmlElement) { ret = ret || attributeExist((XmlElement) object, name, value); } } return ret; }
this.odeWorkflowWSDL = abstractWorkflowWsdl; try { this.odeInvokableWSDL = WSDLUtil.stringToWSDL(abstractWorkflowWsdl.xmlString()); wsdlTransformer.makeWorkflowWSDLConcrete(this.odeInvokableWSDL, this.getName(), dscUrl); wsdlTransformer.setOdeLocation(odeEprEndingWithPort, this.getName(), this.odeInvokableWSDL); Collection<XmlElement> itr = script.getWSDLs(); for (XmlElement xmlElement : itr) { WsdlDefinitions wsdl = WSDLUtil.stringToWSDL(XmlConstants.BUILDER.serializeToString(xmlElement)); String id = xmlElement.attributeValue(NS_XWF, ID_ATTRIBUTE); if (id == null || id.length() == 0) { id = WSDLUtil.getWSDLQName(wsdl).toString(); if (null == id || "".equals(id) || (id.startsWith("{") && id.endsWith("}"))) { QName wsdlQname = new QName(NS_XWF.getName(), WSDLUtil.getFirstOperationName(wsdl, WSDLUtil.getFirstPortTypeQName(wsdl))); id = wsdlQname.toString(); wsdl.xml().setAttributeValue("name", wsdlQname.getLocalPart());
public static WsdlPortTypeOperation getFirstOperation(WsdlDefinitions definitions) throws UtilsException { for (WsdlPortTypeOperation operation : getFirstPortType(definitions).operations()) { return operation; } throw new UtilsException("No portType is defined in WSDL"); }
public static List<XmlNamespace> getNamespaces(XmlElement element) { LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>(); namespaces.add(element.getNamespace()); Iterable<XmlAttribute> attributes = element.attributes(); for (XmlAttribute xmlAttribute : attributes) { if (xmlAttribute.getNamespace() != null && !namespaces.contains(xmlAttribute.getNamespace())) { namespaces.add(xmlAttribute.getNamespace()); } int index = xmlAttribute.getValue().indexOf(':'); if (-1 != index) { String prefix = xmlAttribute.getValue().substring(0, index); if (element.lookupNamespaceByPrefix(prefix) != null) { namespaces.add(element.lookupNamespaceByPrefix(prefix)); } } } Iterable children = element.children(); for (Object object : children) { if (object instanceof XmlElement) { List<XmlNamespace> newNSs = getNamespaces((XmlElement) object); for (XmlNamespace xmlNamespace : newNSs) { if (!namespaces.contains(xmlNamespace)) { namespaces.add(xmlNamespace); } } } } return namespaces; }
XmlElement importedSchema = xsul5.XmlConstants.BUILDER.parseFragmentFromInputStream(connection .getInputStream()); returnType = findTypeInSchema(paramType, importedSchema); if (returnType != null) { return returnType;
/** * @param portTypeQName * @param definitions * @param gfacURL * @param messageBoxURL * @return The invoker * @throws WorkflowException */ public static Invoker createInvoker(QName portTypeQName, WsdlDefinitions definitions, String gfacURL, String messageBoxURL, LeadContextHeader leadContext) throws WorkflowException { Invoker invoker = null; if (definitions != null && definitions.getServices().iterator().hasNext()) { // check if this web service supports asynchronous invocation if (WSDLUtil.isAsynchronousSupported(WSDLUtil.wsdlDefinitions3ToWsdlDefintions5(definitions))) { invoker = new AsynchronousInvoker(definitions, messageBoxURL); } else { invoker = new SimpleInvoker(definitions); } } else if (gfacURL != null && gfacURL.length() != 0) { invoker = new GFacInvoker(portTypeQName, gfacURL, messageBoxURL, leadContext); } if (invoker == null) { String message = "Cannot find an appropriate way to invoke the service"; throw new WorkflowException(message); } return invoker; }
public static boolean attributeExist(XmlElement element, String name, String value) { XmlAttribute attribute = element.attribute(name); if (null != attribute && value.equals(attribute.getValue())) { return true; } Iterable iterator = element.children(); boolean ret = false; for (Object object : iterator) { if (object instanceof XmlElement) { ret = ret || attributeExist((XmlElement) object, name, value); } } return ret; }
/** * @param definitions * @return workflow template ID if the specified WSDL definition is for a workflow; null otherwise. * @throws ComponentException */ public static URI getWorkflowTemplateID(WsdlDefinitions definitions) throws ComponentException { try { // Get template ID from WSDL WsdlPortType portType = WSDLUtil.getFirstPortType(definitions); XmlElement templateIDElement = portType.xml().element(GPEL_NAMESPACE, WORKFLOW_TEMPLATE_ID_TAG); if (templateIDElement == null) { // Not a workflow return null; } else { String templateIDString = templateIDElement.requiredText(); URI templateID = new URI(templateIDString); return templateID; } } catch (URISyntaxException e) { throw new ComponentException(e); } catch (UtilsException e) { throw new ComponentException(e); } } }
public static List<XmlNamespace> getNamespaces(XmlElement element) { LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>(); namespaces.add(element.getNamespace()); Iterable<XmlAttribute> attributes = element.attributes(); for (XmlAttribute xmlAttribute : attributes) { if (xmlAttribute.getNamespace() != null && !namespaces.contains(xmlAttribute.getNamespace())) { namespaces.add(xmlAttribute.getNamespace()); } int index = xmlAttribute.getValue().indexOf(':'); if (-1 != index) { String prefix = xmlAttribute.getValue().substring(0, index); if (element.lookupNamespaceByPrefix(prefix) != null) { namespaces.add(element.lookupNamespaceByPrefix(prefix)); } } } Iterable children = element.children(); for (Object object : children) { if (object instanceof XmlElement) { List<XmlNamespace> newNSs = getNamespaces((XmlElement) object); for (XmlNamespace xmlNamespace : newNSs) { if (!namespaces.contains(xmlNamespace)) { namespaces.add(xmlNamespace); } } } } return namespaces; }
XmlElement importedSchema = xsul5.XmlConstants.BUILDER.parseFragmentFromInputStream(connection .getInputStream()); returnType = findTypeInSchema(paramType, importedSchema); if (returnType != null) { return importEle;
/** * @param uri * @return The URI with "?wsdl" at the end. */ public static String appendWSDLQuary(String uri) { URI wsdlURI = appendWSDLQuary(URI.create(uri)); return wsdlURI.toString(); }
/** * @throws ComponentException */ private void loadComponents(List<ComponentReference> tree) throws ComponentException { // XXX need to use wsdlResolver from xsul, not xsul5, to handle // security. WsdlResolver wsdlResolver = WsdlResolver.getInstance(); WsdlDefinitions definitions = wsdlResolver.loadWsdl(this.url); List<WSComponent> components = WSComponentFactory.createComponents(WSDLUtil .wsdlDefinitions3ToWsdlDefintions5(definitions)); String urlString = this.url.toString(); String name = urlString.substring(urlString.lastIndexOf('/') + 1); URLComponentReference componentReference = new URLComponentReference(name, components); tree.add(componentReference); } }
/** * * @param element * @param name * @param oldValue * @param newValue */ public static void replaceAttributeValue(XmlElement element, String name, String oldValue, String newValue) { XmlAttribute attribute = element.attribute(name); if (null != attribute && oldValue.equals(attribute.getValue())) { element.removeAttribute(attribute); element.setAttributeValue(name, newValue); } Iterable iterator = element.children(); for (Object object : iterator) { if (object instanceof XmlElement) { replaceAttributeValue((XmlElement) object, name, oldValue, newValue); } } }
for (org.xmlpull.infoset.XmlElement schema : schemas) { if (WSDLUtil.attributeExist(schema, "type", "crosscutns:LeadCrosscutParameters")) { for (org.xmlpull.infoset.XmlElement importElement : imports) { found = found || WSDLUtil.attributeExist(importElement, "namespace", "http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/"); if (WSDLUtil.attributeExist(schema, "type", "globalTypens:LEADFileIDArrayType")) { for (org.xmlpull.infoset.XmlElement importElement : imports) { found = found || WSDLUtil.attributeExist(importElement, "namespace", "http://www.extreme.indiana.edu/lead/xsd");