com.ibm.wsdl.extensions.schema.SchemaImpl Java Examples

The following examples show how to use com.ibm.wsdl.extensions.schema.SchemaImpl. 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: SoapProtocol.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void parseWSDLTypes( XSOMParser schemaParser )
	throws IOException {
	Definition definition = getWSDLDefinition();
	if( definition != null ) {
		Types types = definition.getTypes();
		if( types != null ) {
			List< ExtensibilityElement > list = types.getExtensibilityElements();
			for( ExtensibilityElement element : list ) {
				if( element instanceof SchemaImpl ) {
					Element schemaElement = ((SchemaImpl) element).getElement();
					Map< String, String > namespaces = definition.getNamespaces();
					for( Entry< String, String > entry : namespaces.entrySet() ) {
						if( entry.getKey().equals( "xmlns" ) || entry.getKey().trim().isEmpty() ) {
							continue;
						}
						if( schemaElement.getAttribute( "xmlns:" + entry.getKey() ).isEmpty() ) {
							schemaElement.setAttribute( "xmlns:" + entry.getKey(), entry.getValue() );
						}
					}
					parseSchemaElement( definition, schemaElement, schemaParser );
				}
			}
		}
	}
}
 
Example #2
Source File: CxfWSDLImporter.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void importTypes(Types types) {
  SchemaCompiler compiler = XJC.createSchemaCompiler();
  ErrorListener elForRun = new ConsoleErrorReporter();
  compiler.setErrorListener(elForRun);

  SchemaImpl impl = (SchemaImpl) types.getExtensibilityElements().get(0);
  
  S2JJAXBModel intermediateModel = this.compileModel(types, compiler, impl.getElement());
  Collection<? extends Mapping> mappings = intermediateModel.getMappings();

  for (Mapping mapping : mappings){
    this.importStructure(mapping);
  }
}
 
Example #3
Source File: CxfWSDLImporter.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void importTypes(Types types) {
    SchemaCompiler compiler = XJC.createSchemaCompiler();
    ErrorListener elForRun = new ConsoleErrorReporter();
    compiler.setErrorListener(elForRun);

    SchemaImpl impl = (SchemaImpl) types.getExtensibilityElements().get(0);

    S2JJAXBModel intermediateModel = this.compileModel(types, compiler, impl.getElement());
    Collection<? extends Mapping> mappings = intermediateModel.getMappings();

    for (Mapping mapping : mappings) {
        this.importStructure(mapping);
    }
}
 
Example #4
Source File: WSDLConverter.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void convertTypes()
	throws IOException {
	Types types = definition.getTypes();
	if( types != null ) {
		List< ExtensibilityElement > list = types.getExtensibilityElements();
		for( ExtensibilityElement element : list ) {
			if( element instanceof SchemaImpl ) {
				Element schemaElement = ((SchemaImpl) element).getElement();
				// We need to inject the namespaces declared in parent nodes into the schema element
				Map< String, String > namespaces = definition.getNamespaces();
				for( Entry< String, String > entry : namespaces.entrySet() ) {
					if( schemaElement.getAttribute( "xmlns:" + entry.getKey() ).isEmpty() ) {
						schemaElement.setAttribute( "xmlns:" + entry.getKey(), entry.getValue() );
					}
				}
				parseSchemaElement( schemaElement );
			}
		}

		try {
			XSSchemaSet schemaSet = schemaParser.getResult();
			if( schemaSet == null ) {
				throw new IOException( "An error occurred while parsing the WSDL types section" );
			}
			XsdToJolieConverter schemaConverter = new XsdToJolieConverterImpl( schemaSet, false, null );
			typeDefinitions.addAll( schemaConverter.convert() );
		} catch( SAXException | XsdToJolieConverter.ConversionException e ) {
			throw new IOException( e );
		}
	}
}