Package org.apache.axis2.wsdl.codegen

Examples of org.apache.axis2.wsdl.codegen.CodeGenerationException


            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder =
                    documentBuilderFactory.newDocumentBuilder();
            return documentBuilder.parse(configuration.getTypeMappingFile());
        } catch (Exception e) {
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here


       
        Definition definition;
        try {
            definition = readWSDL(uri);
        } catch (WSDLException e) {
            throw new CodeGenerationException(e);
        }
       
        HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports));
       
       // Service service=(Service)definition.getServices().values().().next();
       
        HashSet<QName> donePortTypes= new HashSet<QName>();
       
        for (Iterator sIter  = definition.getServices().values().iterator(); sIter.hasNext(); ) {
            Service service = (Service) sIter.next();
           
            QName serviceQname = service.getQName();
             for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) {
                 Port port= (Port) pIter.next();
                if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested.
                 PortType portType= getPortType(port);
                 if(null == portType) continue; // not connected.
                 QName pQName= portType.getQName();
                 if(donePortTypes.contains(pQName)) continue; //allready did it.
                 donePortTypes.add(pQName);
             
                if (packageName == null) {
                                       
                    packageName = getPackageNameFromNamespace(definition.getTargetNamespace());
                }
                JavaTypeMapper typeMapper = new JavaTypeMapper();
                for (Map.Entry<QName, SDODataBindingTypeMappingEntry> e : typeMapping.entrySet()) {
                    typeMapper.addTypeMappingObject(e.getKey(), e.getValue());
                }

                WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName());
                builder.setCodegen(true);

                AxisService axisService;
                try {
                    axisService = builder.populateService();
                } catch (AxisFault e) {
                    throw new CodeGenerationException(e);
                }

                axisService.setName(port.getBinding().getPortType().getQName().getLocalPart());
                CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP);
                codegenConfigurations.add(codegenConfiguration);
View Full Code Here

            emitter.writeInterface(false);
            }

        } catch (Exception e) {
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here

       
        Definition definition;
        try {
            definition = readWSDL(uri);
        } catch (WSDLException e) {
            throw new CodeGenerationException(e);
        }
       
        HashSet<String> interestedPorts = ports == null ? null : new HashSet<String>(Arrays.asList(ports));
       
       // Service service=(Service)definition.getServices().values().().next();
       
        HashSet<QName> donePortTypes= new HashSet<QName>();
       
        for (Iterator sIter  = definition.getServices().values().iterator(); sIter.hasNext(); ) {
            Service service = (Service) sIter.next();
           
            QName serviceQname = service.getQName();
             for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) {
                 Port port= (Port) pIter.next();
                if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested.
                 PortType portType= getPortType(port);
                 if(null == portType) continue; // not connected.
                 QName pQName= portType.getQName();
                 if(donePortTypes.contains(pQName)) continue; //allready did it.
                 donePortTypes.add(pQName);
             
                if (packageName == null) {
                    //use JAXWS/JAXB NS->package default algorithm, not the SDO/EMF one
                    packageName = XJC.getDefaultPackageName(definition.getTargetNamespace());
                }
                //
                // Use WSDL4J object to generate exception classes
                //
                generateFaults(packageName, portType, typeMapping);
                JavaTypeMapper typeMapper = new JavaTypeMapper();
                for (Map.Entry<QName, SDODataBindingTypeMappingEntry> e : typeMapping.entrySet()) {
                    typeMapper.addTypeMappingObject(e.getKey(), e.getValue());
                    // Added for generation of exceptions from faults
                    typeMapper.addTypeMappingName(e.getKey(), e.getValue().getClassName());
                }


                AxisService axisService;
                WSDL11ToAxisServiceBuilder builder;
                try {
                    //
                    // Added since at a newer level of Axis2, this doesn't work
                    //  without the setCodegen(true)
                    //
                    builder = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName());
                    builder.setCodegen(true);
                    axisService = builder.populateService();
                } catch (AxisFault e) {
                    throw new CodeGenerationException(e);
                }

                axisService.setName(port.getBinding().getPortType().getQName().getLocalPart());
                CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP);
                codegenConfigurations.add(codegenConfiguration);
View Full Code Here

                emitter.writeInterface(false);
            }

        } catch (Exception e) {
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here

            stream.println("        return this.fault;");
            stream.println("    }");
            stream.println("}");
            stream.println();
        } catch (Exception e) {
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here

                }
            }
        }catch(CodeGenerationException ce){
            throw ce;
        }catch(Exception e){
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here

            writeWSDLFiles();

        }catch(CodeGenerationException cgExp){
            throw cgExp;
        }catch(Exception e){
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here

        //first get the language specific property map
        Class clazz = this.getClass();
        Map languageSpecificPropertyMap =
                (Map)ConfigPropertyFileLoader.getLanguageSpecificPropertiesMap().get(this.language);
        if (languageSpecificPropertyMap == null) {
            throw new CodeGenerationException(
                    CodegenMessages.getMessage("writer.noLangPropertiesExtension"));
        }

        String templateName = findTemplate(languageSpecificPropertyMap);
        if (templateName != null) {
            this.xsltStream = clazz.getResourceAsStream(templateName);
        } else {
            throw new CodeGenerationException(CodegenMessages.getMessage("writer.templateMissing"));
        }


    }
View Full Code Here

                }
            }
        } catch (CodeGenerationException ce) {
            throw ce;
        } catch (Exception e) {
            throw new CodeGenerationException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.wsdl.codegen.CodeGenerationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.