title: How to develop/assemble a SOAP cache in JAVA
body: <p><strong>I have the following architecture in my test lab:</strong></p>
  <ul>
  <li><p>N SOAP clients making requests to different Web Services (I can't control the client side technologies, but request are always SOAP XML via HTTP);</p>
  </li>
  <li><p>1 gateway which serves all incoming SOAP requests, routing them to the proper WS's.</p>
  </li>
  </ul>
  <p><strong>Problem:</strong></p>
  <p>My services receive hundreds (sometimes thousands) of requests per day. Many of them are GET requests, which only gather information. Thus, many of these requests are similar, with the only differences being:</p>
  <ul>
  <li>1 control field in the Soap-Env\Header which identifies each request (request ID).</li>
  <li>1 control field in the Soap-Env\Body which identifies the timestamp of the request creation.</li>
  </ul>
  <p><strong>Solution:</strong></p>
  <p>Implement a caching mechanism in the Gateway. When a request to the WS XPTO is received in the gateway, the caching mechanism will compare it with the cached request for that WS, and if they are equal, the cached response is returned to client, avoiding querying the destination WS.</p>
  <p>I'm considering to delete the 2 request control attributes from the XML request string before store it in the cache backend. I can do the same to each incoming request, before compare it to the cached one.</p>
  <p><strong>Requirements:</strong></p>
  <ul>
  <li>Use JAVA for implementation;</li>
  <li>I need to maintain only one cached request/response for each WS;</li>
  <li>Backend must be very fast in read/write response times;</li>
  <li>The comparison of XML SOAP requests must be handled by the backend, since I can't sequentially retrieve them and make the comparison in JAVA for the sake of performance, obviously.</li>
  </ul>
  <p><strong>Questions:</strong></p>
  <p>Given this detailed description (sorry for its length), I would like to ear from the experts which technologies would be best suited for my needs, specially for the backend. I have considered NoSQL and In-memory key-value stores but I can't feel confident that one of them would attend all my needs.</p>
  <ul>
  <li>Should I store the XML in a regular string DB field and then make a simple WHERE query?</li>
  <li>Should I convert the XML request to a JSON document, storing it in a NoSQL DB and further query and compare the requests in this way?</li>
  <li>Should I opt for an In-memory database system, storing the entries as:
  <code>(service_name, [request_XML, response_XML])</code>?</li>
  </ul>