Usingcompressionwebservice

Páginas: 7 (1580 palabras) Publicado: 20 de noviembre de 2012
Using Compression
Introduction
This document describes how to use HTTP compression on Amadeus Web Services using various framework.

Supported Compression Format
As of today, only deflate compression is supported for the responses received from any Amadeus web services. To compress web service requests, both deflate and gzip are currently supported.
GZIP is now available on test systemsas of 07/04/2009, and in production since 16/07/2009.
Note that deflate compression is using zlib encapsulation, as described in below RFCs.

RFC References
HTTP 1.1: RFC 2616
ZLIB: RFC 1950
Deflate: RFC 1951
GZip: RFC 1952

Direct HTTP Implementation
This section describes how to modify an HTTP request so that both the request and the response are compressed. This isframework-independent and is useful in a situation where your web service development framework is not described in this document or when you manipulate HTTP requests directly.
Note that developper have the responsibility to actually compress the SOAP request, except when the development framework supports it out-of-the-box.
Enabling Request Compression
The following line must be added to the HTTP header:Content-Encoding: deflate
Enabling Response Compression
The following line must be added to the HTTP header:
Accept-Encoding: deflate
Note that gzip is currently only supported on test systems (as of 17/04/2009).

.NET Framework
.NET framework (as some other unidentified frameworks) does not implement the ZLIB RFC for deflate compression, thus you need toimplement the below work-arounds.
Enabling HTTP Compression with Generated Proxies
Whether you use .NET 2.0 or .NET 3.0, you can 'easily' enable compression on HTTP transport, both ways.
For that matter you will need to modify you app.config file (or web.config file) as follows:
<configuration>
...
<system.net><webRequestModules>
<remove prefix="http:"/>
<remove prefix="https:"/>
<!-- depending on the version of your installed .NET framework
activate only one of below line
also replace the xxxx with the assembly name containing the below sources-->
<add prefix="http:" type="AWS.AWS_HttpRequestCreator, xxxx "/>
<add prefix="https:" type="AWS.AWS_HttpRequestCreator, xxxx "/>
</webRequestModules>
</system.net>
</configuration>
Those source files need to be added to your project:AWS_HttpRequestCreator.cs AWS_HttpWebRequest.cs AWS_HttpWebResponse.cs AWS_Utils.cs
Enabling HTTP Compression with Direct HTTP Implementation
In this section we describe how to enable compression when actually sending HTTP requests manually. To do so, developpers should do the following:
System.Net.HttpWebRequest req;
req =(HttpWebRequest)HttpWebRequest.Create("https://test.webservices.amadeus.com/");

req.Credentials = CredentialCache.DefaultNetworkCredentials;
// Prevents framework from searching proxy configuration,
// hence removes a long delay on the first request.
//
req.Proxy = null;
req.Method = "POST";
req.ContentType ="text/xml; charset=utf-8";
req.Headers.Add("SOAPAction:\"http://webservices.amadeus.com/1ASIWPOC1A/VLSSLQ_06_1_1A\"");
if (enable_compression)
{
req.Headers.Add("Content-Encoding: deflate");
req.Headers.Add("Accept-Encoding: deflate");
}
Compressing SOAP request
Lets say you have a...
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS