Hi

>
> Test 2 :
>
> RESTXDocReportService.upload(String reportID, byte[] document, List<String>
> fieldsMetaData)  {
>
> Tested by:
>
>   WebClient.post(Collection)
>
>   => .No message body writer found for class : class
> java.util.Arrays$ArrayList.
>

WebClient has methods for getting explicit collections, sending (using
arbitrary HTTP methods) collections and getting collections back, but
no support for sending/posting the collections only and expecting no
collections in return - I can get that improved/fixed. Now, you can
JAXRSClientFactory to create  RESTXDocReportService proxies. However
please also review what I said in the previous email about the
resource methods signatures having possibly many parameters but only
one of those parameters can be mapped to a request payload (with few
exceptions).

>
>
> Test 3:
>
>  RESTXDocReportService.upload(String reportID, byte[] document, List<String>
> fieldsMetaData)  {
>
> Tested by:
>
> WebClient.post(Object[])
>
> => .No message body writer found for class : class [Ljava.lang.Object;.
>

Same problem as for Test2

>
> Test 4:
>
> RESTXDocReportService.upload(String reportID, byte[] document, List<String>
> fieldsMetaData)  {
>
>
> Tested by :
>
>   Form aForm=new Form();
>
> aForm.set("reportID", report.getReportID());
>
> aForm.set("document", report.getDocument());
>
> aForm.set("fieldsMetaData", report.getFieldsMetaData());
>
> client.post(aForm);
>
>
> => .No message body writer found for class : class
> org.apache.cxf.jaxrs.ext.form.Form.
>
>
CXF 2.3.4 and 2.4.0 support  org.apache.cxf.jaxrs.ext.form.Form at the
message body writer level - make sure you also set a proper content
type on web client.

Hope that helps, Sergey

>
> What should I do ? How can I test my REST Service ?
>
>
> Cheers.
>
>
>
>
>
>
>
>
> 2011/6/9 Sergey Beryozkin <[email protected]>
>
>> Please explain what is not working
>>
>> Cheers, Sergey
>>
>> On Wed, Jun 8, 2011 at 11:00 PM, Pascal Leclercq
>> <[email protected]> wrote:
>> > Sergey,
>> >
>> > sorry to bother you but do you have time to have a look at the sample
>> > project included ?
>> > To be more precise, I don't know how to make the REST service
>> > "uploadMultiple" with my Junit tests.
>> >
>> > I would like to know/ understand what's going wrong....
>> >
>> > Thanks in advance.
>> >
>> >
>> >
>> > 2011/6/8 Sergey Beryozkin <[email protected]>
>> >>
>> >> Hi Pascal
>> >>
>> >> > I would like to know if i should create method like this :
>> >> >
>> >> >
>> >> > upload(String id, byte[] content, List<String> metadata)
>> >> >
>> >> > or
>> >> > upload(Report report)
>> >> >
>> >> > and if so how can I handle method like this :
>> >> >
>> >> > uploadAndProcess(Report report, List<DataContext> data, Options
>> >> > options);
>> >> >
>> >>
>> >> As far as JAX-RS is concerned, you can have methods with multiple
>> >> parameters (including explicit collections)
>> >> but only a single method parameter can be mapped to a request payload,
>> >> other parameters, if any, can be mapped to various URI parts or HTTP
>> >> headers or JAX-RS Contexts.
>> >> Multipart attachment parts or form name/value pairs can be mapped to
>> >> multiple parameters, but generally speaking, a request payload has to
>> >> be represented by a single method parameter.
>> >>
>> >> >
>> >> > So far I have no solution for the last case.
>> >> >
>> >> > I don't really want to create a custom request object for each method
>> I
>> >> > create.
>> >>
>> >> You don't have to. It seems that this issue is somewhat orthogonal to
>> >> the issue of how many input parameters a given resource method has.
>> >>
>> >> thanks, Sergey
>> >>
>> >> >
>> >>
>> >>
>> >>
>> >> >
>> >> > Cheers, Pascal.
>> >> >
>> >> > 2011/6/7 Sergey Beryozkin <[email protected]>
>> >> >
>> >> >> Hi
>> >> >>
>> >> >>
>> >> >>
>> >> >> Would you like to have a shared signature for SOAP and REST services
>> ?
>> >> >> You may want to have a method dedicated to serving SOAP requests only
>> >> >> and which would return say DataSource. That method may work for
>> JAX-RS
>> >> >> too.
>> >> >>
>> >> >> And you may also try introducing a method which returns a JAXB bean
>> >> >> capturing the data - this will work for SOAP but also use CXF JAX-RS
>> >> >> RequestDispatcherProvider  to redirect to HTML-aware handlers or use
>> >> >> XSLTJaxbProvider
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> http://cxf.apache.org/docs/jax-rs-redirection.html#JAX-RSRedirection-WithRequestDispatcherProvider
>> >> >>
>> >> >>
>> >> >>
>> http://cxf.apache.org/docs/jax-rs-advanced-xml.html#JAX-RSAdvancedXML-XSLTsupport
>> >> >>
>> >> >> RequestDispatcherProvider and XSLTJaxbProvider are not 'intrusive'
>> and
>> >> >> can help with separating the presentation logic from the main
>> >> >> controller code.
>> >> >>
>> >> >> Some users are combining Struts with CXF as well - but I've no
>> >> >> experience
>> >> >> there
>> >> >>
>> >> >> Cheers, Sergey
>> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Pascal Leclercq
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Sergey Beryozkin
>> >> >>
>> >> >> Application Integration Division of Talend
>> >> >> http://sberyozkin.blogspot.com
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Pascal Leclercq
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Sergey Beryozkin
>> >>
>> >> Application Integration Division of Talend
>> >> http://sberyozkin.blogspot.com
>> >
>> >
>> >
>> > --
>> > Pascal Leclercq
>> >
>> >
>> >
>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Application Integration Division of Talend
>> http://sberyozkin.blogspot.com
>>
>
>
>
> --
> Pascal Leclercq
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Reply via email to