[ 
http://issues.apache.org/jira/browse/AXIS2-1254?page=comments#action_12440884 ] 
            
Amila Chinthaka Suriarachchi commented on AXIS2-1254:
-----------------------------------------------------

When creating my earlier patch I did not notice the tracker variable at the 
template. So although it works it has some redundant code.
In the new patch I have used the tracker variable to make it simplified. In 
addition to fixing this bug I have handle the nillable case in the 
serialization logic too. 
It is bit ambiguous the real meaning of the tracker variable. As I understood 
it is used to keep whether we have to serialize the associated element or not. 
In other words if the tracker is not available (i.e. minOccurs is 1) or present 
and true, we have to serialize the variable. Otherwise ( i.e. tracker is 
present and false) we can ignore it, since min occurs is zero.
When serializing, if the variable is not null, we can serialize it without 
having any problem. If not (i.e if variable is null), if element is set to 
nillable then we write the null attribute, else throw and exception since this 
is an invalid state.


> ADB cannot handle null return value from service method
> -------------------------------------------------------
>
>                 Key: AXIS2-1254
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1254
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: nightly
>         Environment: Linux, Java 1.5
>            Reporter: Dennis Sosnoski
>         Assigned To: Eran Chinthaka
>            Priority: Blocker
>         Attachments: ADBBeanTemplate.xsl-patch-041006.txt, 
> ADBBeanTemplate.xsl-patch-041006.txt, ADBBeanTemplate.xsl-patch-091006.txt, 
> bug.zip
>
>
> When the response content is an optional element null should be a valid 
> return value from the corresponding method. I tried this with the following 
> WSDL/schema fragment:
>       
>       <element name="getBookResponse">
>         <complexType>
>           <sequence>
>             <element name="book" minOccurs="0" type="tns:BookInformation"/>
>           </sequence>
>         </complexType>
>       </element>
>   <wsdl:message name="getBookResponse">
>     <wsdl:part element="wns:getBookResponse" name="parameters"/>
>   </wsdl:message>
> The result was an error on the server side when the corresponding method 
> returned null:
>      [java] Exception in thread "main" org.apache.axis2.AxisFault: 
> java.lang.RuntimeException: book cannot be null!!
>      [java]     at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:298)
>      [java]     at 
> com.sosnoski.ws.library.adb.LibraryAdbStub.getBook(LibraryAdbStub.java:340)
>      [java]     at 
> com.sosnoski.ws.library.adb.WebServiceClient.main(WebServiceClient.java:45)
>      ...
> A null return value should be accepted in this case, resulting in an empty 
> wrapper element (<getBookResponse/>, in this case).

-- 
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