Setting Up Environment

Setting up your environment means verifying you have the necessary prerequisites, setting up a project (if necessary), and generating any proxy code before you can write the code that consumes the web service.

Step Description Applies To
1 Verifying you have the necessary technologies All
2 Creating the project All
3 Generating the SOAP proxy code C#, Java

This section lists the steps we used to create the code in this guide. The steps are helpful if you are not familiar with the tools we used or how they're used with web services. If you prefer, you can just open the project we've already created for you and proceed directly to the next step: Making A Request.

Important:

If you do use the projects included in this guide, be sure to update the AWS_ACCESS_KEY_ID and SECRET_ACCESS_KEY variables with your Access Key ID and Secret Access Key values.

To create the project for C#, open the SimpleQueueService.sln solution file included with the sample code. The solution includes three projects used to create the sample application. All the files necessary for each project are included. You need only to make a few updates to make the sample work.

The next step, Making A Request, has more information about request authentication.

The files containing the code referenced in this guide are: Enqueue.cs in the Enqueue project, Dequeue.cs in the Dequeue project, and Client.cs in the SimpleQueueServiceClient project.

Before making changes to the sample projects, you may want to copy the files to your a new project directory.

The Enqueue and Dequeue projects both depend on the SimpleQueueServiceClient.dll created from SimpleQueueServiceClient project. No changes are necessary to the SimpleQueueServiceClient project.

For both the Enqueue and Dequeue projects, there is a wse3policyCache.config file that needs to reside in the same directory as the executable file generated from the project. This .config file contains settings specific to using X.509 certificates to authenticate the requests from the sample application.

The certificate used for these samples must be installed on the computer where the sample application is running. The certificate must also be issues to Windows user running the sample application. If not, some Access Denied errors may be encountered. Please see the Microsoft Windows documentation for information about certificates.

To use the C# samples you also need a certificate to authenticate your requests. This guide assumes you are using a certificate generated and issued to you by AWS. For information about how to obtain a certificate from AWS, go to the AWS web site. Point to Your Web Services Account, and click View Access Identifiers. The Access Identifiers page is displayed.

Follow the guidance provided on the Access Identifiers page to obtain a certificate from AWS. Note that certificates issued by AWS can be used only for authenticating web service requests to AWS.

To use a certificate generated by AWS with Visual Studio, it must first be converted to PKCS#12 format, and then installed for your Windows user account.

To convert your AWS certificate for use with Visual Studio

  1. Make a copy of the Certificate file (cert-awsthumbprint.pem) and Private Key file (pk-awsthumbprint.pem) you downloaded from the AWS web site and place them in a secure location.

  2. Use a utility such as OpenSSL to convert the file to a PKCS#12 format file. You can use a utility such as Cygwin for a Unix shell in which OpenSSL can be run. Please see the related product documentation for more information.

  3. Run a command similar to the following (depending on the tools used) to convert your AWS certificate:

    openssl pkcs12 -export -inkey pk.pem -in cert.pem -out out.p12 -nodes
  4. Store the files output from the conversion.

  5. To install the certificate, right-click the file, and then select Install Certificate. The certificate is now installed and can be used to authenticate requests to SQS.

    Please see the Windows documentation for more information about installing certificates.

The WSE configuration file is now set to use your certificate with the sample application.