[ 
https://issues.apache.org/jira/browse/AXIS2-3398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Isuru Eranga Suriarachchi resolved AXIS2-3398.
----------------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.6

> Empty array causes other parameter to be null
> ---------------------------------------------
>
>                 Key: AXIS2-3398
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3398
>             Project: Axis2
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Windows XP, Tomcat 5.5
>            Reporter: Stephan Rosner
>            Assignee: Isuru Eranga Suriarachchi
>            Priority: Critical
>             Fix For: 1.6
>
>         Attachments: Axis23398.aar, Axis2BugService.wsdl, client.jar, 
> server.jar
>
>
> Summary: I am trying to invoke the following method via Axis2
> public void arrayFirst(String[] array, TwoStrings object)
> Whenever the first parameter (array) is an empty String array (array = new 
> String[0];), the second object TwoStrings (which simply holds 2 Strings) is 
> always null on the server-side no matter what you put in on the client.
> Detailed: The attached server.jar implements the following 2 methods:
> public void arrayLast(TwoStrings object, String[] array)
> public void arrayFirst(String[] array, TwoStrings object)
> Both of these simply print out the contents of the given parameters. The 
> attached client.jar contains besides the generated stub the following 2 test 
> cases:
> public class BugTest extends TestCase {
>       /**
>        * This does not work
>        * Output on server side is:
>        * --- arrayFirst ---
>        * array.length = 1
>        * stringarray[0] = ''
>        * object == null
>        */
>       public void testArrayFirst() throws RemoteException {
>               String[] stringArray = new String[0];
>               
>               TwoStrings twoStrings = new TwoStrings();
>               twoStrings.setFirstString("first");
>               twoStrings.setSecondString("second");
>               
>               Axis2BugServiceStub stub = new Axis2BugServiceStub();
>               ArrayFirst arrayFirst = new ArrayFirst();
>               arrayFirst.setArray(stringArray);
>               arrayFirst.setObject(twoStrings);
>               
>               stub.arrayFirst(arrayFirst);
>       }
>       
>       /**
>        * This does work
>        * Output on server side is:
>        * --- arrayLast ---
>        * array.length = 0
>        * FirstString = first
>        * SecondString = second
>        */
>       public void testArrayLast() throws RemoteException {
>               String[] stringArray = new String[0];
>               
>               TwoStrings twoStrings = new TwoStrings();
>               twoStrings.setFirstString("first");
>               twoStrings.setSecondString("second");
>               
>               Axis2BugServiceStub stub = new Axis2BugServiceStub();
>               ArrayLast arrayLast = new ArrayLast();
>               arrayLast.setArray(stringArray);
>               arrayLast.setObject(twoStrings);
>               
>               stub.arrayLast(arrayLast);
>       }
> }
> Please note that in the JavaDocs of the methods I have included the printed 
> out results from the server. This means that in the first case, where the 
> empty array is used as the first parameter, Axis2 is thrown off so that the 
> second parameter (the TwoString) results to null on the server. When the 
> empty array is used as the second/last parameter things work as they should.
> Now I can only speculate about the reason, but have noted that in none of 
> these 2 cases the empty array shows up as a parameter within the 
> SOAP-envelope. This is the SOAP-envelope of the testArrayFirst() case:
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
>       <soapenv:Body>
>               <ns2:arrayFirst xmlns:ns2="http://server.nullbug.axis2";>
>                       <ns2:object>
>                               <ns1:firstString 
> xmlns:ns1="http://server.nullbug.axis2/xsd";>first</ns1:firstString>
>                               <ns1:secondString 
> xmlns:ns1="http://server.nullbug.axis2/xsd";>second</ns1:secondString>
>                       </ns2:object>
>               </ns2:arrayFirst>
>       </soapenv:Body>
> </soapenv:Envelope>
> As a workaround we are currently setting the array explicitly to null, which 
> causes the array-parameter to show up within the SOAP-envelope and to 
> transmit correctly again.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to