Dear all, 

I encounter a camel-cxf  's cxf:bean problem 
it seems , it works with return type as Pojo but failed with List<Pojo>
I got exception at karaf like Below. Could anyone give some hints? 

Thanks in advance! 

WARNING: Interceptor for
{http://ws.foo.com/}FileServiceService#{http://ws.foo.com/}getfiles has
thrown exception, unwinding now 
org.apache.cxf.interceptor.Fault 
            at
org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(AbstractWrapperHelper.java:107)
 
            at
org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
 
            at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
 
            at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
 
            at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:26
 


Below are my blueprint and example code 
################################################################## 
define web service Endpoint 
  <camelcxf:cxfEndpoint id="fileService" 
                         
wsdlURL="classpath:/META-INF/wsdl/FileServiceService.wsdl" 
                          address="http://localhost:8080/foo/file";  
                          serviceClass="com.foo.ws.FileService">
    </camelcxf:cxfEndpoint>
  
  //define route , using cxf:bean , the real web service will be implemented
by 
com.foo.camel.FileProcessor 

<bean id="fp" class="com.foo.camel.FileProcessor" >
    </bean>

  <route id="files">
            <from  uri="cxf:bean:fileService" />
            <to    uri="bean:fp" />
        </route>


public class FileProcessor implements Processor { 
    @Override 
    public void process(Exchange exchng) throws Exception { 
        
          // 
              ....... 

           it works with return type as pojo but failed with List<Pojo>

          //           
         List<FilePojo> fileList = results; 

          
         exchng.getOut().setBody( fileList ); 
        } catch (Exception e) { 

            throw new FileNotFoundException("Something goes wrong in "
+this.getClass().getName(), e); 
        } 
    } 

} 

// proxy web serivce, cxf:bean refers to it 

import javax.jws.WebMethod; 
import javax.jws.WebParam; 
import javax.jws.WebResult; 
import javax.jws.WebService; 
import java.util.List; 
/** 
 * 
 */ 
@WebService 
public class FileService { 

    /** 
     * Web service operation 
     */ 
    @WebMethod(operationName = "getfile") 
    @WebResult(name = "file") 
    public ReceivedPDF getfile(@WebParam(name = "fileName") String fileName)
throws Exception{ 
        //TODO write your implementation code here: 
        
        return null; 
    } 

    /** 
     * Web service operation 
     */ 
    @WebMethod(operationName = "getfiles") 
    @WebResult(name = "files") 
    public List<FilePojo> getfiles(@WebParam(name = "fileNames")
List<String> fileNames) throws Exception{ 
        
        return null; 
    } 
    
    
    
    
} 



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-cxf-return-complex-type-object-problem-tp5746478.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to