Responses

Topics

In response to an action request, SQS returns an XML data structure that contains the results of the request. This data conforms to the SQS schema.

Other than the use of a message envelope in the case of SOAP, the schema for the results is the same for Query and SOAP responses. The SOAP WSDL imports an XSD file to define the response messages, and Query users can access the XSD file directly. For more information, see WSDL Location and API Version in the Amazon SQS API Reference.

Structure of a Successful Response

If the request succeeded, the main response element is named after the action, but with "Response" appended. For example, CreateQueueResponse is the response element returned for a successful CreateQueue request. This element contains the following child elements:

  • ResponseMetadata, which contains the RequestId child element

  • An optional element containing action-specific results; for example, the CreateQueueResponse element includes an element called CreateQueueResult

The XML schema describes the XML response message for each SQS action.

The following is an example of a successful response.

<CreateQueueResponse
  xmlns=http://queue.amazonaws.com/doc/2009-02-01/
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
  xsi:type=CreateQueueResponse>
     <CreateQueueResult>
        <QueueUrl>
        http://queue.amazonaws.com/770098461991/queue2
        </QueueUrl>
     </CreateQueueResult>
     <ResponseMetadata>
        <RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
     </ResponseMetadata>
</CreateQueueResponse>

Structure of an Error Response

If a request is unsuccessful, the main response element is called ErrorResponse regardless of the action that was called. This element contains an Error element and a RequestId element. Each Error includes:

  • A Type element that identifies whether the error was a receiver or sender error

  • A Code element that identifies the type of error that occurred

  • A Message element that describes the error condition in a human-readable form

  • A Detail element that might give additional details about the error or might be empty

The following is an example of an error response.

<ErrorResponse>
   <Error>
      <Type>
         Sender
      </Type>
      <Code>
         InvalidParameterValue
      </Code>
      <Message>
         Value (quename_nonalpha) for parameter QueueName is invalid.
         Must be an alphanumeric String of 1 to 80 in length
      </Message>
   </Error>
   <RequestId>
      42d59b56-7407-4c4a-be0f-4c88daeea257
   </RequestId>
</ErrorResponse>

Related Topics