hello,

this is an example that shows the problem.
listSalePointCodesOA and listSalePointCodesIA return an array and works
well, but listSalePointCodes return a List and have the commented
problems.They are defined in.Services and implemented in
ServicesImplementation.
Runner is the class that start the application.
The web services are published in http://localhost:8887/Services?wsdl.

thanks,
Mariano

Source classes:

package application.services.interfaces;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;

import org.osoa.sca.annotations.Remotable;


/**
 * @author Mariano Kohan
 * @version 1.0
 *
 */
@Remotable
public interface Services
    extends Remote
{

    //prueba de retorno de un listado con tipos basicos
    public List listSalePointCodes() throws RemoteException, Exception;
    //se prueba retornando un arreglo de objetos
    public Object[] listSalePointCodesOA() throws RemoteException,
Exception;
    //se prueba retornando un arreglo de objetos basicos
    public Integer[] listSalePointCodesIA() throws RemoteException,
Exception;

}

import application.services.interfaces.Services;

//@Service(Services.class)
public class ServicesImplementation
    implements Services
{

    public ServicesImplementation()
    throws RemoteException
    {
    }

    public List listSalePointCodes() throws RemoteException, Exception {
        //shows only the first and last elements
//        List codes = new LinkedList();
        //shows no elements
        List codes = new ArrayList();
        codes.add(new Integer(1));
        codes.add(new Integer(2));
        codes.add(new Integer(14));
        codes.add(new Integer(61));
        codes.add(new Integer(1));
        codes.add(new Integer(8));
        codes.add(new Integer(33));
        return codes;
    }

    public Object[] listSalePointCodesOA() throws RemoteException, Exception
{
        List codes = this.listSalePointCodes();
        return codes.toArray();
    }

    public Integer[] listSalePointCodesIA() throws RemoteException,
Exception {
        List codes = this.listSalePointCodes();
        Integer[] codesArray = new Integer[codes.size()];
        int i = 0;
        for (Iterator iterator = codes.iterator(); iterator.hasNext();) {
            Integer code = (Integer) iterator.next();
            codesArray[i++] = code;
        }
        return codesArray;
    }

}

package application.server;

import org.apache.tuscany.sca.host.embedded.SCADomain;

public class Runner {

    public Runner(){

    }

    /**
     * inicializacion del dominio SCA
     */
    public void initialize(String xmlFileNameString)
           throws Exception
     {

        System.out.println("Starting of the SCA Application exposed as RMI
and Web Services ...");
        SCADomain scaDomain = SCADomain.newInstance(xmlFileNameString);
        System.out.println("... Press Enter to Exit...");
        System.in.read();
        scaDomain.close();
        System.out.println("Exited...");
        System.exit(0);

     }

    public static void main(String[] args)
    throws Exception
    {
        Runner applicationServicesRunner = new Runner();
        applicationServicesRunner.initialize(args[0]);
    }

}

Configuration Files:

-composite

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
    xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0";
    targetNamespace="http://application";
    name="application">

    <component name="ApplicationServiceComponent">
        <implementation.spring location="test.app\src\resource"/>
        <service name="Services" type="
application.services.interfaces.Services"
            target="SERVICES">
              <binding.ws uri="http://localhost:8887/Services"/>
           </service>

    </component>

-spring beans

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:sca="http://www.springframework.org/schema/sca";
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/sca
http://www.springframework.org/schema/sca/spring-sca.xsd";>

    <sca:service name="Services"
        type="application.services.interfaces.Services" target="SERVICES"/>

    <!-- services -->
    <bean id="SERVICES"
        class="application.services.implementation.ServicesImplementation">
    </bean>

</beans>

2007/12/20, Simon Laws <[EMAIL PROTECTED]>:
>
> On Dec 20, 2007 5:44 PM, Mariano Kohan <[EMAIL PROTECTED]> wrote:
>
> > hello,
> >
> > I have a problem when I expose a service with ws binding.
> > When I want to return a collection of elements, if I use a List type the
> > web
> > service invocation return only 2 elements of the list (when I use
> > LinkedList) or an empty collection (when  I use Array).
> > I suppose the problem is in the implementation of the web service with
> > axis2. It's that right? How can I change the configuration of axis to
> > return
> > all the elements of the List?
> >
> > thanks,
> > Mariano
> >
> Hi Mariano
>
> Can you provide a example of this problem. If you can't provide the whole
> thing then the service interface that you are using would be good (or a
> sample interface that has the same types)? It sounds like it could be
> something wrong with either the way interface definitions are being
> generated or in the way that data is transformed and marshalled across the
> wire. The easiest thing is if you can provide an example that doesn't work
> that can be debugged.
>
> Thanks
>
> Simon
>
> Simon
>

Reply via email to