title: How do I add an attachment to a response payload in Spring-WS?
body: <p>I'm building a Web Services server that's designed to share content. I'd like to serve the content through a SOAP response containing an attachment. Right now, I'm using Spring WS to handle requests and serve responses.</p>
  
  <p>My service resembles something like this:</p>
  
  <pre><code>@Endpoint
  public class Service{
  
      @PayloadRoot(namespace = "http://foo.com/coffee", localPart = "order")
      @ResponsePayload
      public Coffee getCoffee(@RequestPayload Order order){
          return new Coffee("Hot Joe");
      }
  
  }
  </code></pre>
  
  <p>But suppose I want to attach a picture of a cup of coffee to the response, where and how do  I do that?</p>
  
  <p>edit: as an aside, the examples that ship with Spring-WS show how to use the client to send an attachment, but not how the server should respond with one (which is what I'm asking about here).</p>