| using System; using System.IO; using System.Xml.Serialization; using ReportV3AccountPerformanceReportRequest.ReportingV3; namespace ReportV3AccountPerformanceReportRequest { class Program { static void Main(string[] args) { // Some of this code would appear in a // typical report request application. It could // be removed if you only want to capture the // report request variable. // Reporting web service and auth header variables. Reporting objReport; ApiUserAuthHeader apiUserAuthHdr; // Serialization and file variables XmlSerializer xmlSerial; Stream stream; // Create the web service object. objReport = new Reporting(); // Create the auth header and assign values. apiUserAuthHdr = new ApiUserAuthHeader(); apiUserAuthHdr.UserName = "******"; // Use your values. apiUserAuthHdr.Password = "******"; // Use your values. apiUserAuthHdr.UserAccessKey = "******"; // Use your values. // Assign the auth header to the web service member. objReport.ApiUserAuthHeaderValue = apiUserAuthHdr; // Create a report request. AccountPerformanceReportRequest acctPerfReportRequest; acctPerfReportRequest = new AccountPerformanceReportRequest(); // Assign values to the report request variable. // Account ID is application specific, and is // retrieved by a call to CustomerManagement.GetAccounts. acctPerfReportRequest.AccountId = 489; acctPerfReportRequest.AllNone = false; acctPerfReportRequest.ReportLanguage = ReportLanguageType.English; acctPerfReportRequest.Format = APIResultFileType.XML; acctPerfReportRequest.ReportDateRange = ReportDateRangeType.Last6Months; // Serialize the report request parameter to a file. xmlSerial = new XmlSerializer(acctPerfReportRequest.GetType()); stream = new FileStream(@"c:\mysoap\ReportRequest.xml", FileMode.Create, FileAccess.Write, FileShare.None); xmlSerial.Serialize(stream, acctPerfReportRequest); stream.Close(); // Your report request variable has now been serialized to // to the file specified above. // Remaining code not shown. } } } |