Skip to main content
Published: May 08 2009, 2:59:00 PMUpdated: November 28 2020, 5:27:20 PM

Steps to make a SOAP request using C#:

  1. Set a web reference to the WSDL:     
    http://developer.ebay.com/webservices/feedback/latest/FeedbackService.wsdl

    In the sample the reference is named FeedbackAPI
  2. Create a custom class that derives from FeedbackService class
    In the sample the File is named customFeedbackService.cs

  3. Override the GetWebRequest method and set the HTTP request headers
    (You need to specify the UserToken, Operation, Service, Protocol and Version in the HTTP headers)

  4. In the main program, use the custom class to  make the call.

Here is a Console application sample code in C# for createDSRSummaryByPeriod:

Code in the Program.cs file

using System;
using System.Collections.Generic;
using System.Text;
using FeedbackSample.FeedbackAPI;

namespace FeedbackSample
{
    class Program
    {
        static void Main(string[] args)
        {
                //Use the custom class
        customFeedbackService svc = new customFeedbackService(); 
                //Set the production URL
                svc.Url = "https://svcs.ebay.com/FeedbackService";
       
CreateDSRSummaryByPeriodRequest request = new CreateDSRSummaryByPeriodRequest();
                //Set the date range to 30 days
        request.dateRange = new DateRange();
       
request.dateRange.dateFrom = DateTime.Now.AddDays(-30);
       
request.dateRange.dateTo = DateTime.Now;
       
CreateDSRSummaryResponse response = svc.createDSRSummaryByPeriod(request); 
               //Get the JobID from the response
       
string jobID = response.jobId;
        
       
}
    }
}

Code in customFeedbackService.cs file

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using FeedbackSample.FeedbackAPI;

namespace FeedbackSample
{
   
class customFeedbackService : FeedbackAPI.FeedbackService
   
{
       
protected override System.Net.WebRequest GetWebRequest(Uri uri)
       
{
           
HttpWebRequest req = (HttpWebRequest)base.GetWebRequest(uri);
           
//Set the token, Operation, Service, Protocol and Version as HTTP Headers
           
req.Headers.Add("X-EBAY-SOA-SECURITY-TOKEN", "YourToken");
           
req.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "createDSRSummaryByPeriod");
           
req.Headers.Add("X-EBAY-SOA-SERVICE-NAME", "FeedbackService");
           
req.Headers.Add("X-EBAY-SOA-MESSAGE-PROTOCOL", "SOAP11");
           
req.Headers.Add("X-EBAY-SOA-SERVICE-VERSION", "1.0.0");
           
return req;
       
}
   
}
}

 

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