org.apache.xmlbeans.impl.values.XmlComplexContentImpl cannot be cast
--------------------------------------------------------------------

                 Key: AXIS2-3516
                 URL: https://issues.apache.org/jira/browse/AXIS2-3516
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: databinding
    Affects Versions: 1.3
         Environment: Axis2 tools 1.3.0 for eclipse
Eclipse 3.3.1.1
apache-axis2-1.3
apache-tomcat-6.0.16
Windows XP
            Reporter: Samuel Emangard


I expose 3 operations of a service

        public Project[] getProjectsAsArray(String schema, String login) throws 
ServiceException {
                try {
                        return (Project[]) projectDAO.findAllByLogin(schema, 
login).toArray();
                } catch (Exception e) {
                        throwServiceException("Exception while getting projects 
for the login "+login, e);
                        return null;
                }
        }
        
        public Project getFirstProject(String schema, String login) throws 
ServiceException {
                try {
                        return (Project) projectDAO.findAllByLogin(schema, 
login).get(0);
                } catch (Exception e) {
                        throwServiceException("Exception while getting projects 
for the login "+login, e);
                        return null;
                }
        }
        
        public String getFirstProjectName(String schema, String login) throws 
ServiceException {
                try {
                        return ((Project) projectDAO.findAllByLogin(schema, 
login).get(0)).getName();
                } catch (Exception e) {
                        throwServiceException("Exception while getting projects 
for the login "+login, e);
                        return null;
                }
        }

I generated the web service Axis2 archive
with the xmlbeans binding

here is the code of my skeletton

 public 
com.toluna.as.ext.services.project.xsd.GetProjectsAsArrayResponseDocument 
getProjectsAsArray
                  (
                  
com.toluna.as.ext.services.project.xsd.GetProjectsAsArrayDocument 
getProjectsAsArray10
                  )
            throws ServiceException{
                         String schema = 
getProjectsAsArray10.getGetProjectsAsArray1().getSchema();
                         String login = 
getProjectsAsArray10.getGetProjectsAsArray1().getLogin();
                         ArrayList<com.toluna.as.ext.model.project.xsd.Project> 
projectArray = new ArrayList<com.toluna.as.ext.model.project.xsd.Project>();
                         try {
                                 List<Project> projects = new 
ProjectHibernateDAO().findAllByLogin(schema, login);
                                 LOGGER.info("size----> " + projects.size() + " 
for schema "+ schema + " and login " + login);
                                 Iterator it = projects.iterator();
                                 while (it.hasNext()) {
                                         Project project = (Project) it.next();
                                         XMLStreamReader reader = 
BeanUtil.getPullParser(project);
                                         
projectArray.add(com.toluna.as.ext.model.project.xsd.Project.Factory.parse(reader));
                                 }
                                 com.toluna.as.ext.model.project.xsd.Project[] 
returnArray = (com.toluna.as.ext.model.project.xsd.Project[]) 
projectArray.toArray();
                                 GetProjectsAsArrayResponse response = 
GetProjectsAsArrayResponse.Factory.newInstance();
                                 response.setReturnArray(returnArray);
                                 GetProjectsAsArrayResponseDocument doc = 
GetProjectsAsArrayResponseDocument.Factory.newInstance();
                                 doc.setGetProjectsAsArrayResponse(response);
                                 return doc;
                         } catch (Exception e) {
                                 LOGGER.error(e);
                                 throw new ServiceException("", e);
                         } 
        }
                
                
                
                 public 
com.toluna.as.ext.services.project.xsd.GetFirstProjectResponseDocument 
getFirstProject
                  (
                  
com.toluna.as.ext.services.project.xsd.GetFirstProjectDocument getFirstProject0
                  )
            throws ServiceException{
                         String schema = 
getFirstProject0.getGetFirstProject().getSchema();
                         String login = 
getFirstProject0.getGetFirstProject().getLogin();
                         ArrayList<com.toluna.as.ext.model.project.xsd.Project> 
projectArray = new ArrayList<com.toluna.as.ext.model.project.xsd.Project>();
                         try {
                                 List<Project> projects = new 
ProjectHibernateDAO().findAllByLogin(schema, login);
                                 LOGGER.info("size----> " + projects.size() + " 
for schema "+ schema + " and login " + login);
                                 Project project = projects.get(0);
                                 XMLStreamReader reader = 
BeanUtil.getPullParser(project);
                                 GetFirstProjectResponse response = 
GetFirstProjectResponse.Factory.newInstance();
                                 
response.setReturn(com.toluna.as.ext.model.project.xsd.Project.Factory.parse(reader));
                                 GetFirstProjectResponseDocument doc = 
GetFirstProjectResponseDocument.Factory.newInstance();
                                 doc.setGetFirstProjectResponse(response);
                                 return doc;
                         } catch (Exception e) {
                                 LOGGER.error(e);
                                 throw new ServiceException("", e);
                         } 
        }



                 public 
com.toluna.as.ext.services.project.xsd.GetFirstProjectNameResponseDocument 
getFirstProjectName
                  (
                  
com.toluna.as.ext.services.project.xsd.GetFirstProjectNameDocument 
getFirstProjectName6
                  )
            throws ServiceException{
                         String schema = 
getFirstProjectName6.getGetFirstProjectName().getSchema();
                         String login = 
getFirstProjectName6.getGetFirstProjectName().getLogin();
                         ArrayList<com.toluna.as.ext.model.project.xsd.Project> 
projectArray = new ArrayList<com.toluna.as.ext.model.project.xsd.Project>();
                         try {
                                 List<Project> projects = new 
ProjectHibernateDAO().findAllByLogin(schema, login);
                                 LOGGER.info("size----> " + projects.size() + " 
for schema "+ schema + " and login " + login);
                                 String projectName = projects.get(0).getName();
                                 GetFirstProjectNameResponse response = 
GetFirstProjectNameResponse.Factory.newInstance();
                                 response.setReturn(projectName);
                                 GetFirstProjectNameResponseDocument doc = 
GetFirstProjectNameResponseDocument.Factory.newInstance();
                                 doc.setGetFirstProjectNameResponse(response);
                                 return doc;
                         } catch (Exception e) {
                                 LOGGER.error(e);
                                 throw new ServiceException("", e);
                         } 
        }
               
                
                                         
                                         

when I test it with SOAP UI
I always have the following exception (SOAP response)

org.apache.xmlbeans.impl.values.XmlComplexContentImpl cannot be cast to 
com.toluna.as.ext.services.project.xsd.GetProjectsDocument

[I do not have any exception into the tomcat console]

Do you have any solution?



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