This behaviour is being addressed post-beta.

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                       
                                     
                      Stig Hagen                                                       
                                     
                      Dommarsnes               To:       [EMAIL PROTECTED]       
                                     
                      <[EMAIL PROTECTED]>        cc:                                     
                                     
                                               Subject:  inconsistency in bean 
serialization vs. java2wsdl                  
                      03/20/2002 01:35                                                 
                                     
                      PM                                                               
                                     
                      Please respond to                                                
                                     
                      axis-dev                                                         
                                     
                                                                                       
                                     
                                                                                       
                                     



Guys,

congratulations on beta1 - great work!

Now, in 'beta1rc3' there seems to be a minor inconsistency between bean
serialization and wsdl production. Consider this simplistic java bean:

public class MyBean {
   public MyBean() {}
   private String testField;

   public getTestField() { return testField; }
}

The wsdl for a service using this contains a complexType MyBean
<complexType name="MyBean">
   <sequence>
     <element name="testField" nillable="true" type="xsd:string"/>
   </sequence>
</complexType>

and the serialization of the field (leaving out the endless multiRef tag)
is
    <testField xsi:type="xsd:string">field content</message>

which is fine. However, if we change the private field name from
testField to testfield (lowercase 'f'), the wsdl type changes to
<complexType name="MyBean">
   <sequence>
     <element name="TestField" nillable="true" type="xsd:string"/>
   </sequence>
</complexType>

while the serialization is unchanged. This has lead to a couple of
problems in interop using .NET web references, though it's easy to fix
by renaming the field.

The problem seems to be that ser.BeanSerializer uses the property name
from java.beans.Introspector (in BeanSerializer.serialize() around line
160), while in wsdl.fromJava.ClassRep.addFields() uses the name of the
accessor method (minus 'is'/'get') - with no case change - if no
corresponding field (according to ClassRep.isJavaBeanNormal()) exists.

Whew. Anyway, a quick fix would be to add

name = name.substring(0,1).toLowerCase() + name.substring(1);

on line 379 in BeanSerializer (sorry, don't have diff here :( ).
Alternatively, it would be nice if this behaviour was documented, maybe
as a FAQ (though the frequency of asking hasn't been too high yet...). I
could type that one up.

Thanks for your patience through this rather lenghty mail,

Stig

--
Stig Hagen Dommarsnes
Partner, Machina AS / +47 55 96 21 25





Reply via email to