[ 
http://issues.apache.org/jira/browse/AXIS2-807?page=comments#action_12415140 ] 

James Bender commented on AXIS2-807:
------------------------------------

This is an example of how I invoke the Java2WSDL generation:

        String javaInterfaceName = "testexamples.IWWPointsCalculator";
        OutputStream outputStream = new FileOutputStream(wsdlFile);
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
                
        try {
                classLoader.loadClass(javaInterfaceName);
        } catch (Exception ex){
                System.out.println("Java interface not found");
                ex.printStackTrace();
                throw new Exception("Java interface not found", ex);
        }
        Java2WSDLBuilder java2WsdlBuilder = new Java2WSDLBuilder(outputStream, 
javaInterfaceName,
                        classLoader);
                
            String style = Java2WSDLConstants.DOCUMNT;
            String use = Java2WSDLConstants.LITERAL;
                java2WsdlBuilder.setLocationUri("C:/Java/test/wsdl");
                
java2WsdlBuilder.setSchemaTargetNamespace("http://PointsCalculator.ve.kkc.com/types";);
                java2WsdlBuilder.setSchemaTargetNamespacePrefix("types");
                java2WsdlBuilder.setServiceName("PointsCalculator");
                java2WsdlBuilder.setStyle(style);
                
java2WsdlBuilder.setTargetNamespace("http://PointsCalculator.ve.kkc.com/types";);
                java2WsdlBuilder.setTargetNamespacePrefix("ns");
                java2WsdlBuilder.setUse(use);
                java2WsdlBuilder.setWsdlPrefix("ve");
                
                java2WsdlBuilder.generateWSDL();

> For an interface with a complex type parameter for the method, incorrect WSDL 
> is generated
> ------------------------------------------------------------------------------------------
>
>          Key: AXIS2-807
>          URL: http://issues.apache.org/jira/browse/AXIS2-807
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: wsdl
>     Versions: 1.0
>  Environment: Windows XP Professional, Eclipse 3.1.2, JDK 1.5.0
>     Reporter: James Bender
>  Attachments: FoodDescription.java, IWWPointsCalculator.java
>
> I am working on converting an existing Axis2 0.93 web service generator that 
> uses facilities for Java2WSDL and WSDL2Java, by running Ant tasks 
> programmatically with Leafcutter. I started a conversion, yesterday 
> afternoon, to Axis2 Std 1.0, and wanted to use my toy example that has a 
> class with an interface with one method that takes a complex type as a 
> parameter. In Axis2 0.93, I am able to successfully generate the WSDL file, 
> successfully run WSDL2Java, and after programmatically updating the skeleton, 
> compile, and eventually generate a jar and .aar file. The driver is a TestNG 
> test that uses embedded Tomcat 5.5 for testing the generated service.
> When I try to do the same thing with Axis2 Std 1.0, an incorrect WSDL file is 
> generated that is rejected by WSDL2Java:
> INFO     Running: java classname=org.apache.axis2.wsdl.WSDL2Java fork=true 
> classpathref  (arg value=
> -uri ) (arg 
> file=c:\Java\projects2\axis2-std-1.0testbed\build\wsdl\WWPointsCalculator.wsdl
>  ) (arg va
> lue=-s ) (arg value=-ss ) (arg value=-sd ) (arg value=-o ) (arg 
> file=c:\Java\projects2\axis2-std-1.0
> testbed\build\output ) (arg value=-p ) (arg value=testexamples.types ) 
> WARN     Exception in thread "main" 
> org.apache.axis2.wsdl.codegen.CodeGenerationException: Error par
> sing WSDL
> WARN          at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:94)
> WARN          at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
> WARN          at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
> WARN     Caused by: org.apache.axis2.AxisFault: Schema for namespace 
> 'http://PointsCalculator.ve.rec
> ursionsw.com/types' already contains type 'FoodDescription; nested exception 
> is: 
> WARN          java.lang.RuntimeException: Schema for namespace 
> 'http://PointsCalculator.ve.recursionsw.c
> om/types' already contains type 'FoodDescription
> WARN          at 
> org.apache.axis2.description.WSDL2AxisServiceBuilder.populateService(WSDL2AxisServiceBu
> ilder.java:243)
> WARN          at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:87)
> WARN          ... 2 more
> WARN     Caused by: java.lang.RuntimeException: Schema for namespace 
> 'http://PointsCalculator.ve.rec
> ursionsw.com/types' already contains type 'FoodDescription
> WARN          at 
> org.apache.ws.commons.schema.XmlSchema.addType(XmlSchema.java:237)
> WARN          at 
> org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:10
> 3)
> WARN          at 
> org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:233)
> WARN          at 
> org.apache.axis2.description.WSDL2AxisServiceBuilder.getXMLSchema(WSDL2AxisServiceBuild
> er.java:959)
> WARN          at 
> org.apache.axis2.description.WSDL2AxisServiceBuilder.copyExtensibleElements(WSDL2AxisSe
> rviceBuilder.java:1067)
> WARN          at 
> org.apache.axis2.description.WSDL2AxisServiceBuilder.populateService(WSDL2AxisServiceBu
> ilder.java:221)
> The Java2WSDL generator puts two copies of the complex type definition in the 
> file, and that is what is bad. 0.93 did not have that problem, although to 
> produce compilable files, the interface supplied had to be in the default 
> package, a problem seemingly solved in 1.0.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to