Amazon S3 Web services example
==============================
Overview
--------
Amazon S3 is a web service to store data. Amaxon offers a SOAP API to store and retrieve data. We can easily use the gSOAP toolkit to generate source code to interact with AWS S3.
Read the full details in our article [How to Use Amazon Simple Storage Service (S3) in C++ with gSOAP.](../../aws-s3.html)
Below you will find the project build instructions with links to the files you can download from here.
[![To top](../../images/go-up.png) To top](#)
Build steps
-----------
First copy the [`typemap.dat`](typemap.dat) file into your new directory, which has the following lines added:
[command]
_s3__CreateBucketResponse = $ s3__CreateBucketResult* CreateBucketResponse;
_s3__CopyObjectResponse = $ s3__CopyObjectResult* CopyObjectResponse;
Run the wsd2lh tool on Amazon's S3 WSDL to generate a header file [`aws-s3.h`](aws-s3.h):
[command]
wsdl2h -t typemap.dat -o aws-s3.h http://doc.s3.amazonaws.com/2006-03-01/AmazonS3.wsdl
The generated [`aws-s3.h`](aws-s3.h) header file contains all of the class declarations for Amazon S3's service operation requests and responses, along with other Amazon S3 functions and gSOAP functions.
The second step is to use the soapcpp2 tool on the header file created by the wsdl2h tool:
[command]
soapcpp2 -C -j -r aws-s3.h
This generates client-side code (`-C` option), a report (`-r` option) with C++ service proxy classes (`-j` option):
* [`soapStub.h`](soapStub.h) a copy of the specification in plain C/C++ header file syntax without annotations.
* [`soapH.h`](soapH.h) declares XML serializers.
* [`soapC.cpp`](soapC.cpp) implements XML serializers.
* [`soapAmazonS3SoapBindingProxy.h`](soapAmazonS3SoapBindingProxy.h) defines the client-side XML services API proxy class `AmazonS3SoapBindingProxy`.
* [`soapAmazonS3SoapBindingProxy.cpp`](soapAmazonS3SoapBindingProxy.cpp) implements the client-side XML services API proxy class `AmazonS3SoapBindingProxy`.
* [`AmazonS3SoapBinding.nsmap`](AmazonS3SoapBinding.nsmap) XML namespace binding table, you should #include this file.
* [`soapReadme.md`](soapReadme.html) service and data binding interface details.
These files together with `stdsoap2.h` and `stdsoap2.cpp` are needed to build AWS client applications, for example:
[command]
c++ -DWITH_OPENSSL -o putobjectstreaming putobjectstreaming.cpp \
soapAmazonS3SoapBindingProxy.cpp soapC.cpp stdsoap2.cpp -lssl -lcrypto
OpenSSL is required to use AWS with HTTPS, thus the executable is built with `-DWITH_OPENSSL` and the OpenSSL libraries are linked.
See our [article](../../aws-s3.html) for details.
[![To top](../../images/go-up.png) To top](#)
Readme report
-------------
See the auto-generated [soapReadme](soapReadme.html) for this example.
[![To top](../../images/go-up.png) To top](#)