Excellent. The documentation on the link I provided sort of suggested I needed to add an interceptor to get access to them...
John On Monday 20 April 2009 21:34:08 you wrote: > On Mon April 20 2009 3:59:23 pm John Baker wrote: > > Do I need to setup the interceptor? > > Nope. Should be completely automatic. All you would need to do is add > @Resource WebServiceContext context; > to your service class to get the context injected. > > Dan > > > On Monday 20 April 2009 18:44:17 you wrote: > > > Couple of ways to do it: > > > > > > JAX-WS standard way would be through the WebserviceContext: > > > > > > context.getMessageContext().get(MessageContext.INBOUND_MESSAGE_ATTACHME > > >NT S) > > > > > > which would return a Map<String, DataHandler> > > > > > > > > > Semi CXF specific: you can use the WebServiceContext, but cast to the > > > specific CXF type and get the AttachmentList. That avoids some of the > > > conversion that the above would do and enables better streaming: > > > > > > ((org.apache.cxf.jaxws.context.WrappedMessageContext)context.getMessage > > >Co nt ext()).getWrappedMessage().getAttachments() > > > > > > That would return Collection<org.apache.cxf.message.Attachment>. > > > > > > > > > Another option with 2.2: > > > PhaseInterceptorChain.getCurrentMessage().getAttachments(); > > > > > > > > > > > > Dan > > > > > > On Sun April 19 2009 6:21:24 pm John Baker wrote: > > > > Hello, > > > > > > > > What's the quickest/easiest way to get attachments from a SOAP call > > > > in CXF? > > > > > > > > Do we have to use an interceptor, as detailed here: > > > > http://cwiki.apache.org/CXF20DOC/interceptors.html > > > > > > > > Or is there an easier way, using a WebserviceContext perhaps? > > > > > > > > This is the Apache way, which is fairly triival: > > > > > > > > > > > > org.apache.axis.MessageContext context = > > > > org.apache.axis.MessageContext.getCurrentContext(); > > > > Message message = context.getRequestMessage(); > > > > Iterator<AttachmentPart> i = message.getAttachments(); > > > > > > > > Thanks > > > > > > > > > > > > John -- John Baker, Java System Solutions. http://www.javasystemsolutions.com +44 7736 393822
