Test gzip encoded response in WSO2 ESB and App server

For this example i used WSO2 ESB 4.8.0 and AS 5.2.1. Here we will deploy echo service in application service and create API in ESB and invoke it.

01. Enable gzip encoding in Application server
      Go to /wso2as-5.2.1/repository/conf/tomcat directory and edit catalina-server.xml file to enable gzip encoding as follows. Here you will see compression is on and compression minimum size is set as 112 then any response larger than that we encode as gzip. Also we need to specify content types list.

compression="on"
compressionMinSize="112"
compressableMimeType="text/xml;charset=UTF-8,text/plain,text/html,text/javascript,application/x-javascript,application/javascript,application/xml,text/css,application/xslt+xml,text/xsl,image/gif,image/jpg,image/jpeg"

Then deploy echo service in Application Server.


02. Enable wire logs for ESB
add or uncomment following line in log4j.properties file available in /repository/conf directory. 
   log4j.logger.org.apache.synapse.transport.passthru.wire=DEBUG 


Create proxy by pointing to echo service. Then invoke it using some client. You will see following output in ESB console.

[2014-01-08 11:53:16,908] DEBUG - wire >> "POST /addcredits HTTP/1.1[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Host: 10.100.1.65:8280[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Accept-Language: null[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Accept-Encoding: gzip, deflate[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Content-Length: 303[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Content-Type: text/plain; charset=UTF-8[\r][\n]"
[2014-01-08 11:53:16,909] DEBUG - wire >> "Cookie: menuPanel=visible; menuPanelType=main; region2_humantask_menu=visible; region2_bpel_instances_menu=visible; region3_registry_menu=none; requestedURI="../../carbon/configadmin/index.jsp?status=updated&rand=1389152702315"; Modernizr=; current-breadcrumb=manage_menu%2Cservices_menu%2Cservices_list_menu%23configadmin+index.jsp*[\r][\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "Connection: keep-alive[\r][\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "Pragma: no-cache[\r][\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "Cache-Control: no-cache[\r][\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "[\r][\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "[\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "   [\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "   [\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "      [\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "         [\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "         444444[\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "     
[\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "  
[\n]"
[2014-01-08 11:53:16,910] DEBUG - wire >> "
"
[2014-01-08 11:53:16,917] DEBUG - wire << "POST /services/echo HTTP/1.1[\r][\n]"
[2014-01-08 11:53:16,923] DEBUG - wire << "Accept-Language: null[\r][\n]"
[2014-01-08 11:53:16,923] DEBUG - wire << "Cookie: menuPanel=visible; menuPanelType=main; region2_humantask_menu=visible; region2_bpel_instances_menu=visible; region3_registry_menu=none; requestedURI="../../carbon/configadmin/index.jsp?status=updated&rand=1389152702315"; Modernizr=; current-breadcrumb=manage_menu%2Cservices_menu%2Cservices_list_menu%23configadmin+index.jsp*[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Accept-Encoding: gzip, deflate[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Content-Type: text/plain; charset=UTF-8[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Pragma: no-cache[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Cache-Control: no-cache[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Host: 10.100.1.65:9764[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2014-01-08 11:53:16,924] DEBUG - wire << "[\r][\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "12f[\r][\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "[\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "   [\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "   [\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "      [\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "         [\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "         444444[\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "     
[\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "  
[\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "
[\r][\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "0[\r][\n]"
[2014-01-08 11:53:16,925] DEBUG - wire << "[\r][\n]"
[2014-01-08 11:53:16,928] DEBUG - wire >> "HTTP/1.1 200 OK[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "Transfer-Encoding: chunked[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "Content-Encoding: gzip[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "Vary: Accept-Encoding[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "Date: Wed, 08 Jan 2014 06:23:16 GMT[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "Server: WSO2 Carbon Server[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "a[\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "[0x1f][0xffffff8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x0][\r][\n]"
[2014-01-08 11:53:16,929] DEBUG - wire >> "aa[\r][\n]"
[2014-01-08 11:53:16,930] DEBUG - wire >> "[0xffffff80][0x0][0x0][0x0][0xffffffff][0xffffffff]t[0xffffff81][0xffffff9b][0x17][0x1][0x0][0x0][\r][\n]"
[2014-01-08 11:53:16,930] DEBUG - wire >> "0[\r][\n]"
[2014-01-08 11:53:16,930] DEBUG - wire >> "[\r][\n]"
[2014-01-08 11:53:16,933]  WARN - SequenceMediator onError handler : ON_ERROR for sequence : OUT_SEQ_ADD_CREDITS cannot be found
[2014-01-08 11:53:16,941] DEBUG - wire << "HTTP/1.1 200 OK[\r][\n]"
[2014-01-08 11:53:16,943] DEBUG - wire << "Vary: Accept-Encoding[\r][\n]"
[2014-01-08 11:53:16,944] DEBUG - wire << "Content-Encoding: gzip[\r][\n]"
[2014-01-08 11:53:16,944] DEBUG - wire << "Content-Type: application/json[\r][\n]"
[2014-01-08 11:53:16,944] DEBUG - wire << "Server: WSO2 Carbon Server[\r][\n]"
[2014-01-08 11:53:16,944] DEBUG - wire << "Date: Wed, 08 Jan 2014 06:23:16 GMT[\r][\n]"
[2014-01-08 11:53:16,944] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2014-01-08 11:53:16,944] DEBUG - wire << "Connection: keep-alive[\r][\n]"
[2014-01-08 11:53:16,945] DEBUG - wire << "[\r][\n]"
[2014-01-08 11:53:16,945] DEBUG - wire << "58[\r][\n]"

No comments:

Post a Comment

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...