title: Webservice that returns an image plus a number
body: <p>If I have a webservice that returns an image, is there a standard way to also have it return some structured data (in the simplest case, an additional string or number)?</p>
  
  <p>See <a href="https://stackoverflow.com/questions/3939980/php-webservice-that-takes-json-via-post-and-spits-back-an-image">this question</a> for a PHP example of a webservice that returns an image.
  (But my question now is not specific to PHP.)</p>
  
  <p>Possible solutions (mostly not very satisfying):</p>
  
  <ol>
  <li>Put the extra data in the metadata of the image.</li>
  <li>Put the extra data in the HTTP headers.</li>
  <li>Have the webservice return a nonce URL from which the image can be fetched for a limited amount of time.</li>
  <li>Base64-encode the image and make it huge string field in a JSON or XML data structure. (Thanks to <a href="https://stackoverflow.com/users/166761/carles-barrobes">Carles</a> and <a href="https://stackoverflow.com/users/194855/tiago-deliberali-santos">Tiago</a>.)</li>
  </ol>
  
  <p>How would you do it?</p>
  
  <p>(I don't really want to just split the webservice into two separate calls because the webservice takes a ton of parameters and it seems wasteful to send them all twice.)</p>