XFire namespace for array object

View: New views
3 Messages — Rating Filter:   Alert me  

XFire namespace for array object

by Chowpin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

By the way, I've found the previous post where the solution is to use JaxbServiceFactory instead of ObjectServiceFactory
http://www.nabble.com/Problem-returning-a-Collection-or-an-array-using-generics-to9359145.html#a9359145
I'm using org.codehaus.xfire.transport.http.XFireConfigurableServlet and I've set the service factory as
        <serviceFactory>org.codehaus.xfire.jaxb2.JaxbServiceFactory</serviceFactory>
And the result is still the same :(

Regards

Re: XFire namespace for array object

by Chowpin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Have found the open issue, but it's not fixed yet?

http://jira.codehaus.org/browse/XFIRE-526

Re: XFire namespace for array object

by Werner Lehmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would not expect any fix for any issue any time soon. Although "XFire
will continue to be maintained through bug fix releases" (quote website)
I am not seeing any of those for the last 2 years. You can only work
around the problem or consider a switch to e.g. CXF.

Rgds
Werner

Chowpin wrote:
> Have found the open issue, but it's not fixed yet?
>
> http://jira.codehaus.org/browse/XFIRE-526


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

    http://xircles.codehaus.org/manage_email