public WSDL20ToAxisServiceBuilder(Description descriptionComp, QName wsdlServiceName, String interfaceName) { DescriptionElement descriptionElement = descriptionComp.toElement(); savedTargetNamespace = descriptionElement.getTargetNamespace().toString(); namespacemap = descriptionElement.getDeclaredNamespaces(); this.description = descriptionElement.toComponent(); this.serviceName = null; if (wsdlServiceName != null) { serviceName = wsdlServiceName; } this.interfaceName = interfaceName; this.axisService = new AxisService(); setPolicyRegistryFromService(axisService); }
return; if (desEle.getNamespacePrefix(Constants.NS_URI_WSDL20) == null){ String prefix = "wsdl"; int subscript = 0; while (desEle.getNamespaceURI(prefix) != null){ prefix = "wsdl" + subscript++; desEle.addNamespace(prefix, Constants.NS_URI_WSDL20); URI targetNamespace=desEle.getTargetNamespace(); if(targetNamespace!=null){ String targetNamespaceStr = targetNamespace.toString(); NamespaceDeclaration[] namespaces = desEle.getDeclaredNamespaces(); printExtensibilityAttributes(desEle.getExtensionAttributes(), desEle, pw); printNamespaceDeclarations(namespaces, pw); pw.println('>'); printDocumentation(desEle.getDocumentationElements(), desEle, pw); printImports(desEle.getImportElements(), desEle, pw); printIncludes(desEle.getIncludeElements(), desEle, pw); printTypes(desEle.getTypesElement(), desEle, pw); printInterfaces(desEle.getInterfaceElements(), desEle, pw); printBindings(desEle.getBindingElements(), desEle, pw); printServices(desEle.getServiceElements(), desEle, pw); printExtensibilityElements(desEle.getClass(), desEle.getExtensionElements(), desEle, pw); pw.println("</" + tagName + '>'); pw.flush();
URI tns = desc.getTargetNamespace(); if (tns != null) { namespace[0] = tns.toString(); String prefix = desc.getNamespacePrefix(tns); if(prefix != null) { namespace[1] = prefix;
schemaDef = retrieveSchema(importEl, desc.getDocumentBaseURI(), schemaLoc); ImportElement[] imports = desc.getImportElements(); for(int i=0; i<imports.length; i++) { ImportElement importElem = (ImportElement) imports[i]; DescriptionElement nestedDesc = importElem.getDescriptionElement(); if(nestedDesc != null) { TypesElement typesElem = nestedDesc.getTypesElement(); if(typesElem != null) { Schema[] schemas = typesElem.getSchemas(schema.getNamespace()); IncludeElement[] includes = desc.getIncludeElements(); for(int i=0; i<includes.length; i++) { IncludeElement includeElem = (IncludeElement) includes[i]; DescriptionElement nestedDesc = includeElem.getDescriptionElement(); if(nestedDesc != null) { TypesElement typesElem = nestedDesc.getTypesElement(); if(typesElem != null) { Schema[] schemas = typesElem.getSchemas(schema.getNamespace());
Description descComp = descElem.toComponent();
ImportElement[] imports = descElement.getImportElements(); int numImports = imports.length; for(int i = 0; i < numImports; i++) if(!validateTypes(descElement.getTypesElement(), errorReporter)) isValid = false; if(!validateInterfaces(descElement, descElement.getInterfaceElements(), errorReporter)) isValid = false;
public WSDL20ToAxisServiceBuilder(String wsdlUri, String name, String interfaceName) throws WSDLException { String fullPath = wsdlUri; if (!wsdlUri.startsWith("http://")) { File file = new File(wsdlUri); fullPath = file.getAbsolutePath(); } setBaseUri(fullPath); Description description; try { description = readInTheWSDLFile(fullPath); } catch (AxisFault axisFault) { throw new WSDLException("ERROR", "Exception occured while reading WSDL 2.0 doc", axisFault); } DescriptionElement descriptionElement = description.toElement(); savedTargetNamespace = descriptionElement.getTargetNamespace() .toString(); namespacemap = descriptionElement.getDeclaredNamespaces(); this.description = description; this.serviceName = null; if (name != null) { serviceName = new QName(descriptionElement.getTargetNamespace().toString(), name); } this.interfaceName = interfaceName; this.axisService = new AxisService(); setPolicyRegistryFromService(axisService); }
public XmlSchemaType getType() { XmlSchemaType xst = null; DescriptionElement desc = getDescriptionElement(getParentElement()); TypesImpl types = (TypesImpl)desc.getTypesElement(); if(types != null) { xst = types.getTypeDefinition(fTypeName); } return xst; }
/** * recursively drills down to find all type definitions * (XSD schemas) in all imported WSDLs and XSDs * * @param descriptionElement - a description element from where import elements * and types can be found */ private void processTypes(DescriptionElement descriptionElement) { TypesElement typesElement = descriptionElement .getTypesElement(); if (typesElement != null) { Schema[] schemas = typesElement.getSchemas(); for (int i = 0; i < schemas.length; i++) { XmlSchema schemaDefinition = schemas[i].getSchemaDefinition(); // WSDL 2.0 spec requires that even the built-in schema should be returned // once asked for schema definitions. But for data binding purposes we can ignore that if (schemaDefinition != null && !Constants.URI_2001_SCHEMA_XSD .equals(schemaDefinition.getTargetNamespace())) { axisService.addSchema(schemaDefinition); } } } ImportElement[] importElements = descriptionElement.getImportElements(); for (int i = 0; i < importElements.length; i++) { DescriptionElement descElem = importElements[i].getDescriptionElement(); processTypes(descElem); // recursively drill down } }
/** * recursively drills down to get namespace pairs in nested imported elements * * @param descriptionElement - a description element from where import elements * and types can be found */ private void createNamespaceMap(DescriptionElement descriptionElement) { ImportElement[] importElements = descriptionElement.getImportElements(); for (int i = 0; i < importElements.length; i++) { DescriptionElement descElem = importElements[i].getDescriptionElement(); NamespaceDeclaration[] namespaceDeclarations = descElem.getDeclaredNamespaces(); for (int j = 0; j < namespaceDeclarations.length; j++) { NamespaceDeclaration importedNamespaceDeclaration = namespaceDeclarations[j]; if (!stringBasedNamespaceMap.containsKey(importedNamespaceDeclaration.getPrefix())) { stringBasedNamespaceMap.put(importedNamespaceDeclaration.getPrefix(), importedNamespaceDeclaration.getNamespaceURI().toString()); } } createNamespaceMap(descElem); // recursively drill down } }
TypesElement types = desc.getTypesElement(); if (types == null) { types = desc.addTypesElement(); desc.getTypesElement().addSchema(parseSchemaImport(xmlEl, desc));
/** * Test assertion Description-1006. Tests whether the target namespace * specified is an absolute IRI. * * @param descElement The description element for which to check the target namespace. * @param errorReporter The error reporter. * @return True if the assertion passes, false otherwise. * @throws WSDLException */ protected boolean testAssertionDescription1006(DescriptionElement descElement, ErrorReporter errorReporter) throws WSDLException { URI targetNS = descElement.getTargetNamespace(); if(!targetNS.isAbsolute()) { errorReporter.reportError(new ErrorLocatorImpl(), "Description-1006", new Object[]{targetNS}, ErrorReporter.SEVERITY_ERROR); return false; } return true; }
String baseURI = desc.getDocumentBaseURI() != null ? desc.getDocumentBaseURI().toString() : null; Iterator it = Arrays.asList(desc.getDeclaredNamespaces()).iterator(); while(it.hasNext()) { NamespaceDeclaration d = (NamespaceDeclaration)it.next();
private void collectIncludedDescriptions(List descs, DescriptionElement desc) { IncludeElement[] includes = desc.getIncludeElements(); for(int i = 0; i < includes.length; i++) { DescriptionElement includedDesc = includes[i].getDescriptionElement(); if(includedDesc != null && !descs.contains(includedDesc)) { descs.add(includedDesc); } collectIncludedDescriptions(descs, includedDesc); } }
BindingElement[] bindings = desc.getBindingElements(); for(int j=0; j<bindings.length; j++)
ServiceElement[] services = desc.getServiceElements(); for(int j=0; j<services.length; j++)
InterfaceElement[] interfaces = desc.getInterfaceElements(); for(int j=0; j<interfaces.length; j++)
schemaDef = retrieveSchema(importEl, desc.getDocumentBaseURI(), schemaLoc); ImportElement[] imports = desc.getImportElements(); for(int i=0; i<imports.length; i++) { ImportElement importElem = (ImportElement) imports[i]; DescriptionElement nestedDesc = importElem.getDescriptionElement(); if(nestedDesc != null) { TypesElement typesElem = nestedDesc.getTypesElement(); if(typesElem != null) { Schema[] schemas = typesElem.getSchemas(schema.getNamespace()); IncludeElement[] includes = desc.getIncludeElements(); for(int i=0; i<includes.length; i++) { IncludeElement includeElem = (IncludeElement) includes[i]; DescriptionElement nestedDesc = includeElem.getDescriptionElement(); if(nestedDesc != null) { TypesElement typesElem = nestedDesc.getTypesElement(); if(typesElem != null) { Schema[] schemas = typesElem.getSchemas(schema.getNamespace());
private Description readWSDL(String wsdlURL, OMElement docEl) throws WSDLException { XMLElement descEl = createXMLElement(docEl); DescriptionElement descElem = parseDescription(wsdlURL, descEl, null); Description descComp = descElem.toComponent(); //TODO if schema errors, don't do any further validation (i.e. assertions assume WSDL is schema valid) // Validate the model if validation is enabled. if(features.getValue(WSDLReader.FEATURE_VALIDATION)) { /* if(docValidator == null) { docValidator = new WSDLDocumentValidator(); } if(docValidator.validate(descElem, getErrorReporter())) { if(compValidator == null) { compValidator = new WSDLComponentValidator(); } compValidator.validate(descComp, getErrorReporter()); } */ (new WSDLValidator()).validate(descComp, fWsdlContext); } return descComp; }
ImportElement[] imports = descElement.getImportElements(); int numImports = imports.length; for(int i = 0; i < numImports; i++) if(!validateTypes(descElement.getTypesElement(), errorReporter)) isValid = false; if(!validateInterfaces(descElement, descElement.getInterfaceElements(), errorReporter)) isValid = false;