axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Srinath Perera" <hemap...@opensource.lk>
Subject Re: Null pointer Java2WSDL (Think I got the problem)
Date Wed, 18 Feb 2004 15:47:56 GMT
Hi all;

yes as Glan pointed out there is something more behind the BUG.

This WSDL2Java fail IFF the command line is used, if we use ant task (on
which the tests are based on) this does work,
becouse of the line 247 of the
org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask
emitter.setTypeMapping(tmi);

I think that is why this goes undeteteced.
**
In the formJava Emitter the only way to set the typemapping is
setTypeMapping(TypeMapping) - org.apache.axis.wsdl.fromJava.Emitter

But the only referance to the emitter.setTypeMapping() is at the
generateWSDL(MessageContext) - org.apache.axis.providers.BasicProvider
which is used for runtime WSDL generation... not Java2WSDL command line.
So the typemapping is always null if we use the commnad line(IMO)

If we use command line Java2WSDL fails for **any wsdl**(IMHO) which has
some type that is not registerd in the DefaultTypeMapping.
**

there are two solutions I can see (both should work, may be we do the both)
	1) check for null, (if null just ignore so that the code below in same
method
	can handle the situation)
	2)Initialize the type mapping in the Java2WSDL as do in the ant task
		 // Create TypeMapping and register complex types
	         tmi = new TypeMappingImpl(defaultTM);
        	 Iterator i = complexTypes.iterator();
            	 while (i.hasNext()) {
                 	( (ComplexType)i.next()).register(tmi);
                 }
            	emitter.setTypeMapping(tmi);

Thanks
Srinath



> +1 to check for null.
>
> +1 to add XSDParser.
>
> -- dims
>
> --- Srinath Perera <hemapani@opensource.lk> wrote:
>> the code of axis.1.1 vs HEAD is like this (see in the bottem of the
>> mail).
>> Basically 1.1 check for null and Axis HEAD do not.
>> Shall we change it back??
>>
>>
>> let me add a quary about AXIS_JAXME migration in WSDL2Java. As we had
>> put all the JAXME parser code inside the SymbolTable it has gone over
>> about 4000 lines :( . Shall we make a Class (e.g. XSDParser) and  put
>> the
>> code there and give referance to symbol table.  else everybody  will
>> have
>> pretty hard time scrolling.
>>
>> Thanks
>>
>> Srinath
>>
>>
>>
>> =========================== Axis 1.1
>> ======================================
>> QName qName = null;
>>
>>         // Use the typeMapping information to lookup the qName.
>>         QName dQName = null;
>>         if (defaultTM != null) {
>>             dQName = defaultTM.getTypeQName(javaType);
>>         }
>>         if (tm != null) {
>>             qName = tm.getTypeQName(javaType);
>>         }
>>         if (qName == null) {
>>             qName = dQName;
>>         } else if (qName != null && qName != dQName) {
>>             // If the TM and default TM resulted in different
>>             // names, choose qName unless it is a schema namespace.
>>             // (i.e. prefer soapenc primitives over schema primitives)
>>             if (Constants.isSchemaXSD(qName.getNamespaceURI())) {
>>                 qName = dQName;
>>             }
>>         }
>>
>> ====================== HEAD ==================================
>> QName qName = defaultTM.getTypeQName(javaType);
>>         if(qName == null) {
>>             qName = tm.getTypeQName(javaType);
>>         }
>> =================================================================
>>
>>
>> > Srinath,
>> >
>> > Where can i find the heavytest.performence.HeavyTest classes?
>> >
>> > -- dims
>> >
>> > --- Srinath Perera <hemapani@opensource.lk> wrote:
>> >> Hi All;
>> >>
>> >> In the Current Head in the Axis I am getting a null pointer exception
>> >> for the Java2WSDL, I check with axis1.2 alpha and it is working there
>> >> fine.
>> >> java.lang.NullPointerException
>> >> 	at org.apache.axis.wsdl.fromJava.Types.getTypeQName(Types.java:688)
>> >> at org.apache.axis.wsdl.fromJava.Types.getTypeQName(Types.java:702)
>> >> at
>> >> org.apache.axis.wsdl.fromJava.Types.writeTypeForPart(Types.java:420)
>> >> at
>> >> org.apache.axis.wsdl.fromJava.Emitter.writePartToMessage(Emitter.java:1854)
>> >> 	at
>> >> org.apache.axis.wsdl.fromJava.Emitter.writeRequestMessage(Emitter.java:1447)
>> >> 	at
>> >> org.apache.axis.wsdl.fromJava.Emitter.writeMessages(Emitter.java:1095)
>> >> at
>> >> org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:1066)
>> >> at org.apache.axis.wsdl.fromJava.Emitter.getWSDL(Emitter.java:499) at
>> >> org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:350) at
>> >> org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:445) at
>> >> org.apache.axis.wsdl.Java2WSDL.run(Java2WSDL.java:622)
>> >> 	at org.apache.axis.wsdl.Java2WSDL.main(Java2WSDL.java:668)
>> >>
>> >> this is the command I used
>> >>
>> >> org.apache.axis.wsdl.Java2WSDL
>> >> -otemp.wsdl -l"http://localhost:8080/axis/services/WidgetPrice"
>> >> heavytest.performence.HeavyTest
>> >>
>> >> I am trying to fix it, But want to confirm it is a bug.
>> >> If anybody knows something about it give me a hand
>> >>
>> >> Srinath
>> >>
>> >>
>> >
>> >
>> > =====
>> > Davanum Srinivas - http://webservices.apache.org/~dims/
>>
>>
>> ------------------------------------
>> Lanka Sofware Foundation
>> ------------------------------------
>>
>>
>
>
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/
>
>


------------------------------------
Lanka Sofware Foundation
------------------------------------

Mime
View raw message