2011-08-22 2 views
0

좋은 놈!Resteasy 서비스의 param 같은 목록

어떻게 Resteasy 서비스에 param과 같은 목록을 보내시겠습니까?

내가 실행할 수 있습니다

예외 추적을 던졌습니다 :

내 서비스는이 양식을 선언
java.lang.RuntimeException: could not find writer for content-type multipart/mixed type: java.util.ArrayList 
    at org.jboss.resteasy.client.ClientRequest.writeRequestBody(ClientRequest.java:474) 
    at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor$ClientRequestEntity.<init>(ApacheHttpClientExecutor.java:154) 
    at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.loadHttpMethod(ApacheHttpClientExecutor.java:226) 
    at org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor.execute(ApacheHttpClientExecutor.java:78) 
    at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:39) 
    at org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor.execute(AcceptEncodingGZIPInterceptor.java:40) 
    at org.jboss.resteasy.core.interception.ClientExecutionContextImpl.proceed(ClientExecutionContextImpl.java:45) 
    at org.jboss.resteasy.client.ClientRequest.execute(ClientRequest.java:449) 
    at org.jboss.resteasy.client.ClientRequest.httpMethod(ClientRequest.java:679) 
    at org.jboss.resteasy.client.ClientRequest.put(ClientRequest.java:541) 
    at org.jboss.resteasy.client.ClientRequest.put(ClientRequest.java:546) 
    at Principal.main(Principal.java:74) 

:

@PUT 
    @Path("gravarBoletos") 
    @Consumes("multipart/mixed") 
    @Produces(MediaType.TEXT_PLAIN) 
    public Integer gravarBoletos(List<TituloTO> tituloTOs) throws ExcecaoSistema, ExcecaoNegocio; 

나는이 양식 내 클라이언트에서 호출

ClientRequest request = new ClientRequest(urlWebService + "/mFinanceiroService/gravarBoletos"); 

    request.accept("multipart/mixed"); 
    request.body("multipart/mixed", tituloImport.getTituloTOs()); 

    ClientResponse<Integer> response = request.put(Integer.class); 

    System.out.println(response.getEntity()); 

을 아무도 나를 도와? 감사합니다.

답변

0

@Wrapped 주석을 사용하십시오.

<foo:list xmlns:foo="http://foo.org"> 
     <customer><name>bill</name></customer> 
     <customer><name>monica</name></customer> 
</foo:list> 
:

@GET 
@Path("list") 
@Produces("application/xml") 
@Wrapped(element="list", namespace="http://foo.org", prefix="foo") 
public List<Customer> getCustomerSet(){ 
    List<Customer> list = new ArrayList<Customer>(); 
    list.add(new Customer("bill")); 
    list.add(new Customer("monica")); 

    return list; 
} 

이 XML을 반환