Hi, I'm having problem capturing return value in array object using XFire
client

Let's say i have a service that return value as shown below that return
array object "Campaign"

        @WebResult(name="CampaignResult")
        @WebMethod
        public Campaign[] queryCampaign(
                @WebParam(name="CampaignQueryData") CampaignQD qd) {

                Campaign[] campaigns = new Campaign[2];
                ....
                return campaigns;
        }

And the Campaign itself is a very simple POJO

        @XmlAccessorType(XmlAccessType.PROPERTY)
        @XmlType(name="Campaign",
namespace="http://security.soap.connector.rcp.client";)
        public class Campaign {

                private static final long serialVersionUID = 1L;
                
                private String name;
                
                @XmlElement(name="Name",
namespace="http://security.soap.connector.rcp.client";)
                public String getName() {
                        return name;
                }
                public void setName(String name) {
                        this.name = name;
                }
        }
        
When I create a client stub using XFire wsgen and execute the service, 
                
        Campaigns result = port.queryCampaign(qd);
        List<Campaign> l = result.getCampaignList();
        System.out.println(l.size());

I try to monitor using Apache TCPMon and the response XML contain return
result
But it is not showing in the client code where the return value "l.size()"
is 0.
I notice it's caused by the namespace issue. Currently there's a workaround
where i just need to create a new class

        @XmlAccessorType(XmlAccessType.PROPERTY)
        @XmlType(name="Campaigns",
namespace="http://security.soap.connector.rcp.client";)
        public class CampaignList {
                
                private List<Campaign> campaigns;

                @XmlElement(name="CampaignList",
namespace="http://security.soap.connector.rcp.client";)
                public List<Campaign> getCampaigns() {
                        return campaigns;
                }

                public void setCampaigns(List<Campaign> campaigns) {
                        this.campaigns = campaigns;
                }
                
        }
        
Is there any other way to solve this issue instead of creating a new POJO
that wrap the array object?


Regards
-- 
View this message in context: 
http://www.nabble.com/XFire-namespace-for-array-object-tp24141525p24141525.html
Sent from the XFire - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to