Avoid conditional GET request issue with cache mediator in WSO2 ESB

<api xmlns="http://ws.apache.org/ns/synapse" name="ArcGIS" context="/GeoCoding">
<resource methods="GET" uri-template="/GeoCode*">
<inSequence>
<property name="POST_TO_URI" value="true" scope="axis2" type="STRING"></property>
<property name="uri.var.format" expression="$ctx:query.param.format" scope="default" type="STRING"></property>
<property name="uri.var.address" expression="$ctx:query.param.address" scope="default" type="STRING"></property>
<log>
<property name="format" expression="get-property('uri.var.format')"></property>
<property name="address" expression="get-property('uri.var.address')"></property>
</log>
<cache id="arcGisSingleCache" scope="per-host" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="100" maxMessageSize="1000000">
<implementation type="memory" maxSize="1000000"></implementation>
</cache>
<send>
<endpoint>
<http method="get" uri-template="http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text={uri.var.address}&f={uri.var.format}"></http>
</endpoint>
</send>
</inSequence>
<outSequence>
<cache id="arcGisSingleCache" scope="per-host" collector="true"></cache>
<log level="full"></log>
<send/>
</outSequence>
</resource>
</api>
TID: [0] [ESB] [2014-04-29 14:28:51,741] DEBUG {org.apache.synapse.transport.http.wire} - >> "GET /GeoCoding/GeoCode?address=seoul HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,741] DEBUG {org.apache.synapse.transport.http.wire} - >> "Host: 162.44.168.228:8280[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,741] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,742] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,749] INFO {org.apache.synapse.mediators.builtin.LogMediator} - format = json, address = seoul {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:28:51,754] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /GeoCoding/GeoCode?address=seoul, MessageID: urn:uuid:773bf9f5-ff71-434e-9d65-807d3cb29b65, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:28:51,764] DEBUG {org.apache.synapse.transport.http.wire} - << "GET http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=seoul&f=json HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,765] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,765] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,765] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,766] DEBUG {org.apache.synapse.transport.http.wire} - << "Host: geocode.arcgis.com:80[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,766] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,766] DEBUG {org.apache.synapse.transport.http.wire} - << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:51,767] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,164] DEBUG {org.apache.synapse.transport.http.wire} - >> "HTTP/1.1 200 OK[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,164] DEBUG {org.apache.synapse.transport.http.wire} - >> "Via: 1.1 CDTSTMG02[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,164] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Proxy-Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Date: Tue, 29 Apr 2014 18:28:52 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "Content-Type: text/plain;charset=utf-8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,165] DEBUG {org.apache.synapse.transport.http.wire} - >> "ETag: d9537e6b[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "Server: [\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "Cache-Control: max-age=0,must-revalidate[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "Set-Cookie: AGS_ROLES="419jqfa+uOZgYod4xPOQ8Q=="; Version=1; Max-Age=60; Expires=Tue, 29-Apr-2014 18:30:02 GMT; Path=/arcgis/rest; HttpOnly[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,166] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "143[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "{"spatialReference":{"wkid":4326,"latestWkid":4326},"locations":[{"name":"Seoul, Seoul, South Korea","extent":{"xmin":126.85532000000001,"ymin":37.456209999999999,"xmax":127.1934,"ymax":37.705689999999997},"feature":{"geometry":{"x":126.97782765600061,"y":37.56825582300047},"attributes":{"Score":100,"Addr_Type":"POI"}}}]}[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,168] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:28:52,207] INFO {org.apache.synapse.mediators.builtin.LogMediator} - GEO API = RESPONSE {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:28:52,209] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:4a2d34ea-cf46-4e4e-8bec-aee1a3936c3b, Direction: response, MESSAGE = INCOMING, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload">{"spatialReference":{"wkid":4326,"latestWkid":4326},"locations":[{"name":"Seoul, Seoul, South Korea","extent":{"xmin":126.85532000000001,"ymin":37.456209999999999,"xmax":127.1934,"ymax":37.705689999999997},"feature":{"geometry":{"x":126.97782765600061,"y":37.56825582300047},"attributes":{"Score":100,"Addr_Type":"POI"}}}]}</text></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,610] DEBUG {org.apache.synapse.transport.http.wire} - >> "GET /GeoCoding/GeoCode?address=seoul HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,610] DEBUG {org.apache.synapse.transport.http.wire} - >> "Host: 162.44.168.228:8280[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,610] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,611] DEBUG {org.apache.synapse.transport.http.wire} - >> "If-None-Match: d9537e6b[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,612] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,625] INFO {org.apache.synapse.mediators.builtin.LogMediator} - format = json, address = colombo {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,629] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /GeoCoding/GeoCode?address=colombo, MessageID: urn:uuid:a784dda4-faa5-4a82-8758-111f4b8cd330, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,636] DEBUG {org.apache.synapse.transport.http.wire} - << "GET http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=colombo&f=json HTTP/1.1[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Language: en-US,en;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept-Encoding: gzip,deflate,sdch[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "If-None-Match: d9537e6b[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Host: geocode.arcgis.com:80[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,637] DEBUG {org.apache.synapse.transport.http.wire} - << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,638] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,973] DEBUG {org.apache.synapse.transport.http.wire} - >> "HTTP/1.1 304 Not Modified[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,974] DEBUG {org.apache.synapse.transport.http.wire} - >> "Via: 1.1 CDTSTMG02[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,974] DEBUG {org.apache.synapse.transport.http.wire} - >> "Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,974] DEBUG {org.apache.synapse.transport.http.wire} - >> "Proxy-Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,975] DEBUG {org.apache.synapse.transport.http.wire} - >> "Date: Tue, 29 Apr 2014 18:29:10 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,975] DEBUG {org.apache.synapse.transport.http.wire} - >> "Age: 0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,975] DEBUG {org.apache.synapse.transport.http.wire} - >> "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,983] INFO {org.apache.synapse.mediators.builtin.LogMediator} - GEO API = RESPONSE {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,984] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:d79666e6-b6e1-4ccd-972c-a8cac419e1ef, Direction: response, MESSAGE = INCOMING, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body></soapenv:Body></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "HTTP/1.1 304 Not Modified[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "Age: 0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "Via: 1.1 CDTSTMG02[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,989] DEBUG {org.apache.synapse.transport.http.wire} - << "Content-Type: application/xml[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Proxy-Connection: Keep-Alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Date: Tue, 29 Apr 2014 18:29:10 GMT[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Server: WSO2-PassThrough-HTTP[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Transfer-Encoding: chunked[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "Connection: keep-alive[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,990] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,991] DEBUG {org.apache.synapse.transport.http.wire} - << "0[\r][\n]" {org.apache.synapse.transport.http.wire}
TID: [0] [ESB] [2014-04-29 14:29:10,991] DEBUG {org.apache.synapse.transport.http.wire} - << "[\r][\n]" {org.apache.synapse.transport.http.wire}
<header name="If-None-Match" scope="transport" action="remove"/><cache id=”arcGisSingleCache”
scope=”per-host”
collector=”false”
hashGenerator=”org.wso2.caching.digest.DOMHASHGenerator”
timeout=”60″
maxMessageSize=”1000000″>
<implementation type=”memory” maxSize=”1000000″/>

--

--

--

https://www.linkedin.com/in/gayan-liyanagamage/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Exception handling middleware in .NET Core

Dagger 2 with MVVM SIMPLIFIED!

Udacity Self Driving Car Nanodegree Term1 Project1 Finding Lane Lines.

Azure Database for PostgreSQL Single Server intermittent restart and recovery due to undocumented…

Customers, users and loyalty in the web3 world

TLS Certificates for Kubernetes Admission Webhooks made easy with Certificator and Helm Hook?

Challenge in Ansible Playbook — making HTTPD service idempotence and make it consume less resource.

SQL 4주차

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gayan Liyanagamage

Gayan Liyanagamage

https://www.linkedin.com/in/gayan-liyanagamage/

More from Medium

Building Barriers Only Crossable By True Fans

Multi-tenant deployments with Camunda BPM and SpringBoot

Symbolic image für multi-tenancy

Kafka: A multi-schema consumer (Avro types)

How to ease the maintenance of a low technical debt : Strategic Choices