RPCServiceClient response handling incorrect when there are multi byte[] object 
in the return bean
--------------------------------------------------------------------------------------------------

                 Key: AXIS2-3538
                 URL: https://issues.apache.org/jira/browse/AXIS2-3538
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb, rpc
    Affects Versions: 1.3
         Environment: WinXP, JDK 1.5
Spring+Axis2 1.3

            Reporter: Qiuming Bao


I'm using the axis2 with Spring integrated. POJO Spring  bean as service is 
working.
But the object returned/retrieved on the client side ( with RPCServiceClient) 
is incorrect. 
In the return object, there are several byte[] attributes. 
On the client, the return object's byte[] attributes will be set with the value 
of the first byte[] attribute. 
 
Following is the modified WeatherSpringService code based on axis2 bundled 
sample. 

/** Weather.java */
package sample.spring.bean;

public class Weather{
    float temperature;
    String forecast;
    boolean rain;
    float howMuchRain;
    byte[] b1;
    byte[] b2;
    byte[] b3;
    
    public void setTemperature(float temp){
        temperature = temp;
    }

    public float getTemperature(){
        return temperature;
    }
    
    public void setForecast(String fore){
        forecast = fore;
    }

    public String getForecast(){
        return forecast;
    }
    
    public void setRain(boolean r){
        rain = r;
    }

    public boolean getRain(){
        return rain;
    }
    
    public void setHowMuchRain(float howMuch){
        howMuchRain = howMuch;
    }

    public float getHowMuchRain(){
        return howMuchRain;
    }
    
    public void setB1(byte[] b) { 
        this.b1 = b;
    }
    public byte[] getB1() { 
        return b1;
    }
    public void setB2(byte[] b) { 
        this.b2 = b;
    }
    public byte[] getB2() { 
        return b2;
    }
    public void setB3(byte[] b) { 
        this.b3 = b;
    }
    public byte[] getB3() { 
        return b3;
    }
}



/** WeatherSpringRPCClient .java */
package client;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

import sample.spring.bean.Weather;

public class WeatherSpringRPCClient {

    public static void main(String[] args1) throws AxisFault {

        RPCServiceClient serviceClient = new RPCServiceClient();

        Options options = serviceClient.getOptions();

        EndpointReference targetEPR 
                = new EndpointReference(
                "http://localhost:8080/axis2/services/WeatherSpringService";); 
        
        options.setTo(targetEPR);

        // Get the weather (no setting, the Spring Framework has already 
initialized it for us)
        QName opGetWeather = new QName("http://service.spring.sample/xsd";, 
"getWeather");

        Object[] opGetWeatherArgs = new Object[] { };
        Class[] returnTypes = new Class[] { Weather.class };
        
        
        Object[] response = serviceClient.invokeBlocking(opGetWeather,
                opGetWeatherArgs, returnTypes);
        
        Weather result = (Weather) response[0];
        
        // display results
        if (result == null) {
            System.out.println("Weather didn't initialize!");
        }else{
            System.out.println("Temperature               : " +
                               result.getTemperature());
            System.out.println("Forecast                  : " +
                               result.getForecast());
            System.out.println("Rain                      : " +
                               result.getRain());
            System.out.println("How much rain (in inches) : " +
                               result.getHowMuchRain());
            System.out.println("Byte b1 : " +
                               new String(result.getB1()));
            System.out.println("Byte b2 : " +
                               new String(result.getB2()));
            System.out.println("Byte b3 : " +
                               new String(result.getB3()));
        }
    }
}

/** WeatherSpringService */
package sample.spring.service;

import sample.spring.bean.Weather;

public class WeatherSpringService{
    Weather weather;
    byte[] b1 = "Hello b1".getBytes();
    byte[] b2 = "Hello b2".getBytes();
    byte[] b3 = "Hello b3".getBytes();
    
    public void setWeather(Weather w){
        weather = w;
        w.setB1(b1);
        w.setB2(b2);
        w.setB3(b3);
    }

    public Weather getWeather(){
        return weather;
    }
}

/** The result printed out is */

rpc.client.run:
     [echo] F:\Software\java\axis2-1.3\samples\pojoguidespring\build.xml
     [java] log4j:WARN No appenders could be found for logger (org.apache.axis2.
util.Loader).
     [java] log4j:WARN Please initialize the log4j system properly.
     [java] Temperature               : 89.9
     [java] Forecast                  : Sunny
     [java] Rain                      : false
     [java] How much rain (in inches) : 0.2
     [java] Byte b1 : Hello b1
     [java] Byte b2 : Hello b1
     [java] Byte b3 : Hello b1


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