An individual Attachment part can not be represented as a List.

More precisely, when we have a single part with the embedded attachments, then you can not currently model it with the CXF MultipartBody, ie, if you need a payload like the one shown here
(with the embedded parts)

https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2

then the client side can not do it yet (the server can handle it)

So create a single Attachment per every part.


The server signature is OK, but you will need to mark each of the parameters with @Multipart(name="..."), or use only MultipartBody

Cheers, Sergey

On 29/05/17 16:33, nicolasduminil wrote:
Sorry, I provided here an inadvertent code of the client. The current one is
as follows:

     List<Attachment> attachments = new ArrayList<Attachment>();
     TransactionContextDTO ctx = new TransactionContextDTO();
     attachments.add(new Attachment("create-transaction-context",
MediaType.APPLICATION_JSON, ctx));
     List<FileInputStream> contracts = new ArrayList<FileInputStream>();
     contracts.add(new FileInputStream (new File ("test.pdf")));
     attachments.add(new Attachment ("contracts",
MediaType.APPLICATION_OCTET_STREAM, contracts));
     Response resp = client.target(new
URI("http://localhost:9081/qs/services/api/createTransaction";)).request().post(Entity.entity(new
MultipartBody(attachments), MediaType.MULTIPART_FORM_DATA));
     assertEquals (200, resp.getStatus());


kind regards,

Nicolas



--
View this message in context: 
http://cxf.547215.n5.nabble.com/HTTP-415-raised-by-JAX-RS-service-consuming-multipart-tp5780784p5780818.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to