Review SOAP Envelopes to Retrieve Information

The SOAP envelope represents (in XML format) all of the elements included within a message. You can use this SOAP envelope to review the information present in the message and use your preferred coding language to retrieve information from that envelope.

When reviewing SOAP envelopes, you see two different types of envelopes:

  1. Request - the information passed from you to the API
  2. Response - the information generated by the API after processing your request and returned to you

The example below represents a typical SOAP request envelope:

The example below represents a typical SOAP response envelope.Use this envelope as the model for all calls in this technical article:

The SOAP envelopes include a client ID value used to perform calls in sub-accounts, such as in an Enterprise 2.0 account. If you are performing the action in the same account you are logged into, you don't need to include this value.

In addition to retrieving information from SOAP envelopes, you can use them to get information about errors. The SOAP request below fails because no client ID is specified and the application could not find the applicable triggered send(as it was located in another account):

The SOAP response envelope contains information about the error. In this case, the create request failed because no client ID was specified and the application could not find the applicable triggered send (as it was located in another account):

You can review the successful request envelope below:

The call below retrieves the Status Code from the above SOAP envelope (identified in the <par:StatusCode></par:StatusCode> tags):

The call below retrieves the Status Message from the above SOAP envelope (identified in the <par:StatusMessage></par:StatusMessage> tags):

The call below retrieves the Request ID from the above SOAP envelope (identified in the <par:RequestID></par:RequestID> tags):

The call below retrieves the Overall Status from the SOAP envelope (identified in the <par:OverallStatus></par:OverallStatus> tags):

Some environments (like Eclipse) auto-complete available methods, allowing you to choose the appropriate information to retrieve.

You can use trace logging to pull back information from SOAP request and response envelopes. Insert the following code into the web.config or app.config files (at the bottom of the configuration) in your development environment and modify the file path location (contained in the initializeData="..." section of the code) to save the information to your chosen file. From there, you can either manually or programmatically search for the desired information:

Trace Logging