Skip to main content
Published: August 15 2006, 2:03:00 PMUpdated: July 26 2022, 12:55:06 PM

What is the difference between Execute() and ExecuteRequest() in the .NET SDK?

When using the .NET SDK, the Execute() method should be used to actually make the API call.

The idea with ExecuteRequest is to give the ability to instantiate a call wrapper object (CompleteSaleCall for example is an SDK call wrapper), but use the actual underlying SOAP request object to make the call, and use the actual underlying SOAP response object to receive the response.

This is useful if you uprev the WSDL version, but the release of the wrapper classes you are using do not have properties for newer properties that are in the request or response WSDL. This allows you to use newer features that are in the API call, but that are not yet implemented in the SDK call wrapper.

Using CompleteSale as an example, you could do this:

  CompleteSaleCall api = new CompleteSaleCall(Context);
  CompleteSaleRequestType CompleteSaleRequest = new CompleteSaleRequestType();
 

  // set your call parameters through CompleteSaleRequest
  CompleteSaleRequest.Paid = true;
  ...
  CompleteSaleResponseType res = new CompleteSaleResponseType();
  res = api.ExecuteRequest(CompleteSaleRequest);

The general recommendation is to use Execute() especially in light of the frequent SDK releases that we are now doing.

ExecuteRequest should only be used in the case where there is no explicit call wrapper support for some request or response elements that you need to use.

 

Attachments
How well did this answer your question?
Answers others found helpful