Tuesday, August 13, 2013

How to test Compression (gzip encoding) in WSO2 App Server server side response/During the deployment time.

1. First make sure echo service is deployed in your AS pack which you are going to test. (This will be available by deafult)

2. Then give the echo service wsdl as the endpoint and create a soap project. E.g.,

3. Then Go to <AS_HOME>/repository/conf/tomcat and edit the catalina-server.xml.

4. Use the document http://tomcat.apache.org/tomcat-7.0-doc/config/http.html as reference.

   noCompressionUserAgents="gozilla, traviata"  

 If you want to disable gzip encoding, make compression="off". By default this will be on.
 You have to provide the correct MimeType of your request. E.g., text/xml

5. Now start the AS server.

6. Open a tcp mon and open a port listening to 9764 and target point as 9763. Host name will be the host address of your AS, which is echo service is available. E.g., localhost/

7. Go to SOAP Project created and open the  echoString request editor.

8. Change the endpoint as it goes to the listen port we set in tcpmon.

9. Now send a request, (You can change this request by editing the "in" value as the string will be more than or lesser than compressionMinSize value and test more how these properties will work)


  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:echo="http://echo.services.core.carbon.wso2.org">  


 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">  
    <ns:echoStringResponse xmlns:ns="http://echo.services.core.carbon.wso2.org">  

10. Now test the response headers via tcpmon or via soap raw values.

 You should see the request and response headers as follows:

 Request Header :

POST /services/echo.echoHttpSoap11Endpoint/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_0_1020577184.1376370045484"
SOAPAction: "urn:echoString"
MIME-Version: 1.0
Content-Length: 703
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

 Response Header :

HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Tue, 13 Aug 2013 05:00:45 GMT
Server: WSO2 Carbon Server


Note : You can test other parameters as well by using this sample