Hello,
we have moved the detailed discussion into private convo with Sergey, but
for the record or for those of you who might check thisthread later on, here
is an update:
I have implemented both of Sergeys suggestions but, alas, the parameter
mapping still does not work for me. What I did is this:
1. I am setting now the JAXBElementProvider for the JAXRSServer and setting
its UnmarshallAsJaxbElement property to true;
2. I manually added @Multipart("...") annotations to the parameters of the
JAXB generated Webservice interface;
3. I am creating now two Parts for msgCtx and emailMessage and posting them
over by means of httpclient.
Unfortunatelly I still get NullPointerException for parameters thus the
param-mapping does not work for me even with the @Multipart hack.
cheers
Reinis
Sergey Beryozkin-2 wrote:
>
> <snip/>
> S.B : ok, thanks... So ServiceMessageContext and EmailMessage are just
> @XmlType(s)...See, JAXRS does not really like multiple
> request parameters referring to request bodies (as in sendEmail) thus CXF
> JAXRS does not unwrap the way CXF JAXWS does (which is
> very JAXWS compliant) but here we're dealing with a multipart request so
> even thought it is not standardized in JAXRS, it makes
> sense to refer to individual parts through the use of multiple parameters.
> But the problem is that ServiceMessageContext and
> EmailMessage have no @XmlRootElement - I think you can just register a
> JAXRS JAXBElementProvider and set an 'unmarshalAsJaxbElement'
> property on it and it should fix the JAXB-related issue...
> <snip/>
> S.B. Next, given that CXF JAXRS does not unwrap (well, at the moment at
> least), one needs to 'attach' @Multipart annotations to
> individual method parameters for the MultipartProvider to figure out which
> part needs be deserialized. Given that you've chosen to
> use a user model this may seem like a step back but lets just make it work
> and then I can look at extending the model support... So
> now we have :
>
> sendEmail(@Multipart("context") ServiceMessageContext ctx,
> @Multipart("email") EmailMessage message)
> <snip/>
> S.B : In meantime, please ensure you have two parts, the above fragment
> just uses a single part but a real multipart/form-data
> would have one part containing a service context, the other one containing
> the body with this second body part containing
> embedded/recursive parts, one per every email attachment. You probably
> just do not need this kind of complexity (yet), just create a
> multipart/mixed or may be multipart/related (and update @Produces) request
> containing two parts, one will 'hold' the context another
> one an email message including the binary content.
> <snip/>
> View this message in context:
> http://old.nabble.com/no-annotations-RESTfull-webservice---a-complex-use-case-tp27685209p27686868.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
View this message in context:
http://old.nabble.com/no-annotations-RESTfull-webservice---a-complex-use-case-tp27685209p27714207.html
Sent from the cxf-user mailing list archive at Nabble.com.