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

Carlos Martins updated AXIS2-4940:
----------------------------------

    Description: 
Calling a simple method which returns java.util.List<String> causes the server 
to throw the exception
javax.xml.bind.JAXBException: java.util.List is not known to this context.
I followed the issue *bold*[AXIS2-3736]*bold* and in fact created a small maven 
application with a simple webservice and axis2 1.5.4

{code}
package com.audaxys.lease.model.generic;

import java.util.ArrayList;
import java.util.List;

import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.ResponseWrapper;

@WebService(name="AppleFinderService", serviceName="AppleFinderService", 
portName="Rpc", targetNamespace="http://com.audaxys.lease/";)
public class AppleFinderImpl implements AppleFinder {

    @WebResult(name = "appleListReturn", targetNamespace = 
"http://com.audaxys.lease/";)
    @ResponseWrapper(className = 
"com.audaxys.lease.model.generic.AppleListResponse" , 
localName="appleListResponse", targetNamespace="http://com.audaxys.lease/";)
        public List<Apple> getAppleList(String appType) {
        List<Apple> apples = new ArrayList<Apple>();
        Apple a = new Apple();
        a.setAppleType("Red");
        apples.add(a);
        a = new Apple();
        a.setAppleType("Green");
        apples.add(a);
        return apples;
        }

    public Apple[] getAppleArray(String appType) {
        List<Apple> apples = new ArrayList<Apple>();
        Apple a = new Apple();
        a.setAppleType("Red");
        apples.add(a);
        a = new Apple();
        a.setAppleType("Green");
        apples.add(a);
        Apple[] appleArray = new Apple[apples.size()];
        int i=0; 
        for(Apple app : apples) {
                appleArray[i++] = app;
        }
        return appleArray;
        }
    
    public String obtemUmaString() {
        return "uma string";
    }

    public Apple loadApple(String appType) {
        Apple a = new Apple();
        a.setAppleType(appType);
        return a;
    }
    
    public List<String> getStringList(String str) {
        List<String> l = new ArrayList<String>();
        for(int i=0; i< 10; i++) {
                l.add(str);
        }
        return l;
    }

    public String[] getStringArray(String str) {
        String[] l = new String[10];
        for(int i=0; i< 10; i++) {
                l[i] = "Red";
        }
        return l;
    }

}
{code}

  was:
Calling a simple method which returns java.util.List<String> causes the server 
to throw the exception
javax.xml.bind.JAXBException: java.util.List is not known to this context.
I followed the issue [AXIS2-3736] and in fact created a small maven application 
with a simple webservice and axis2 1.5.4

package com.audaxys.lease.model.generic;

import java.util.ArrayList;
import java.util.List;

import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.ResponseWrapper;

@WebService(name="AppleFinderService", serviceName="AppleFinderService", 
portName="Rpc", targetNamespace="http://com.audaxys.lease/";)
public class AppleFinderImpl implements AppleFinder {

    @WebResult(name = "appleListReturn", targetNamespace = 
"http://com.audaxys.lease/";)
    @ResponseWrapper(className = 
"com.audaxys.lease.model.generic.AppleListResponse" , 
localName="appleListResponse", targetNamespace="http://com.audaxys.lease/";)
        public List<Apple> getAppleList(String appType) {
        List<Apple> apples = new ArrayList<Apple>();
        Apple a = new Apple();
        a.setAppleType("Red");
        apples.add(a);
        a = new Apple();
        a.setAppleType("Green");
        apples.add(a);
        return apples;
        }

    public Apple[] getAppleArray(String appType) {
        List<Apple> apples = new ArrayList<Apple>();
        Apple a = new Apple();
        a.setAppleType("Red");
        apples.add(a);
        a = new Apple();
        a.setAppleType("Green");
        apples.add(a);
        Apple[] appleArray = new Apple[apples.size()];
        int i=0; 
        for(Apple app : apples) {
                appleArray[i++] = app;
        }
        return appleArray;
        }
    
    public String obtemUmaString() {
        return "uma string";
    }

    public Apple loadApple(String appType) {
        Apple a = new Apple();
        a.setAppleType(appType);
        return a;
    }
    
    public List<String> getStringList(String str) {
        List<String> l = new ArrayList<String>();
        for(int i=0; i< 10; i++) {
                l.add(str);
        }
        return l;
    }

    public String[] getStringArray(String str) {
        String[] l = new String[10];
        for(int i=0; i< 10; i++) {
                l[i] = "Red";
        }
        return l;
    }

}



> java.util.List is not known to this context
> -------------------------------------------
>
>                 Key: AXIS2-4940
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4940
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, Addressing, codegen, jaxws, kernel
>    Affects Versions: 1.5.4
>         Environment: IBM AIX; Java-1.6; Tomcat 6; Axis2 1.5.4
>            Reporter: Carlos Martins
>
> Calling a simple method which returns java.util.List<String> causes the 
> server to throw the exception
> javax.xml.bind.JAXBException: java.util.List is not known to this context.
> I followed the issue *bold*[AXIS2-3736]*bold* and in fact created a small 
> maven application with a simple webservice and axis2 1.5.4
> {code}
> package com.audaxys.lease.model.generic;
> import java.util.ArrayList;
> import java.util.List;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import javax.xml.ws.ResponseWrapper;
> @WebService(name="AppleFinderService", serviceName="AppleFinderService", 
> portName="Rpc", targetNamespace="http://com.audaxys.lease/";)
> public class AppleFinderImpl implements AppleFinder {
>     @WebResult(name = "appleListReturn", targetNamespace = 
> "http://com.audaxys.lease/";)
>     @ResponseWrapper(className = 
> "com.audaxys.lease.model.generic.AppleListResponse" , 
> localName="appleListResponse", targetNamespace="http://com.audaxys.lease/";)
>       public List<Apple> getAppleList(String appType) {
>         List<Apple> apples = new ArrayList<Apple>();
>         Apple a = new Apple();
>         a.setAppleType("Red");
>         apples.add(a);
>         a = new Apple();
>         a.setAppleType("Green");
>         apples.add(a);
>         return apples;
>       }
>     public Apple[] getAppleArray(String appType) {
>         List<Apple> apples = new ArrayList<Apple>();
>         Apple a = new Apple();
>         a.setAppleType("Red");
>         apples.add(a);
>         a = new Apple();
>         a.setAppleType("Green");
>         apples.add(a);
>         Apple[] appleArray = new Apple[apples.size()];
>         int i=0; 
>         for(Apple app : apples) {
>               appleArray[i++] = app;
>         }
>         return appleArray;
>       }
>     
>     public String obtemUmaString() {
>       return "uma string";
>     }
>     public Apple loadApple(String appType) {
>         Apple a = new Apple();
>         a.setAppleType(appType);
>         return a;
>     }
>     
>     public List<String> getStringList(String str) {
>       List<String> l = new ArrayList<String>();
>       for(int i=0; i< 10; i++) {
>               l.add(str);
>       }
>       return l;
>     }
>     public String[] getStringArray(String str) {
>       String[] l = new String[10];
>       for(int i=0; i< 10; i++) {
>               l[i] = "Red";
>       }
>       return l;
>     }
> }
> {code}

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