Skip to main content
Published: October 13 2011, 1:44:00 PMUpdated: November 28 2020, 10:05:00 PM

How can I make a simple LeaveFeedback call using the .NET SDK (VB)?

Summary

LeaveFeedback VB sample



Detailed Description

This sample is using Microsoft Visual Studio 2010, eBay .NET SDK Version 715 - .NET 2.0 Point Release

Requirements:

After opening a VB project,

-  Add a reference to eBay.Service dll

-  Make sure Target Framework is NOT set to .NET Framework Client Profile

 

1.  Add these namespaces

Imports eBay
Imports eBay.Service
Imports eBay.Service.Call
Imports eBay.Service.Core.Sdk
Imports eBay.Service.Core.Soap
Imports eBay.Service.Util

2.  Code Sample (This sample was in a windows form project in a button click):

'© 20101-2013 eBay Inc., All Rights Reserved
'Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php
 

Dim oContext As New ApiContext()

        ' set the AuthToken - Production Token
        oContext.ApiCredential.eBayToken = "XXX"
        oContext.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi" 'for Sandbox calls
        'oContext.SoapApiServerUrl = "https://api.ebay.com/wsapi"

        ' set the Site of the Context
        oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US

        ' very important, let's setup the logging
        Dim oLogManager As New ApiLogManager()
        oLogManager.ApiLoggerList.Add(New eBay.Service.Util.FileLogger("log.txt", True, True, True))
        oLogManager.EnableLogging = True
        oContext.ApiLogManager = oLogManager

        ' the WSDL Version used for this SDK build
        oContext.Version = "729"

        ' set the CallRetry properties
        Dim oCallRetry As New CallRetry()
        ' set the delay between each retry to 1 millisecond
        oCallRetry.DelayTime = 1
        ' set the maximum number of retries
        oCallRetry.MaximumRetries = 3
        ' set the error codes on which to retry
        Dim oErrorCodes As New StringCollection()
        oErrorCodes.Add("10007")
        ' Internal error to the application ... general error
        oErrorCodes.Add("2")
        ' unsupported verb error
        oErrorCodes.Add("251")
        ' eBay Structured Exception ... general error
        oCallRetry.TriggerErrorCodes = oErrorCodes
        ' set the exception types on which to retry
        Dim oExceptions As New TypeCollection()
        oExceptions.Add(GetType(System.Net.ProtocolViolationException))
        ' the "Client found response content type of 'text/plain'" exception is of type SdkException, so let's add that to the list
        oExceptions.Add(GetType(SdkException))
        oCallRetry.TriggerExceptions = oExceptions

        ' set CallRetry back to ApiContext
        oContext.CallRetry = oCallRetry

        ' set the timeout to 2 minutes
        oContext.Timeout = 120000

        Dim oLeaveFeedback As New LeaveFeedbackCall(oContext)

        ' set the Version used in the call
        oLeaveFeedback.Version = oContext.Version

        ' set the Site of the call
        oLeaveFeedback.Site = oContext.Site

        ' enable the compression feature
        oLeaveFeedback.EnableCompression = True

        oLeaveFeedback.ItemID = "###"
        oLeaveFeedback.OrderLineItemID = "###-###"
        oLeaveFeedback.TransactionID = "###"
        oLeaveFeedback.CommentText = "Excellent and quick service. The item is Beautiful. 5 **** !"
        oLeaveFeedback.TargetUser = "TESTUSER_XXX"
        oLeaveFeedback.CommentType = CommentTypeCodeType.Positive

        '***** If Positive feeback is given the provide the Detailed Seller Ratings

        Dim ir As ItemRatingDetailsType = New ItemRatingDetailsType
        ir.RatingDetail = FeedbackRatingDetailCodeType.ItemAsDescribed
        ir.Rating = "5"    

        Dim ir1 As ItemRatingDetailsType = New ItemRatingDetailsType
        ir1.RatingDetail = FeedbackRatingDetailCodeType.Communication
        ir1.Rating = "5"
     
        Dim ir2 As ItemRatingDetailsType = New ItemRatingDetailsType
        ir2.RatingDetail = FeedbackRatingDetailCodeType.ShippingAndHandlingCharges
        ir2.Rating = "5"

        Dim ir3 As ItemRatingDetailsType = New ItemRatingDetailsType
        ir3.RatingDetail = FeedbackRatingDetailCodeType.ShippingTime
        ir3.Rating = "5"

        oLeaveFeedback.SellerItemRatingDetailArrayList = New ItemRatingDetailsTypeCollection(New ItemRatingDetailsType() {ir, ir1, ir2, ir3})

        oLeaveFeedback.LeaveFeedback(oLeaveFeedback.ItemID, oLeaveFeedback.CommentText, oLeaveFeedback.CommentType, oLeaveFeedback.TransactionID, oLeaveFeedback.TargetUser,    oLeaveFeedback.SellerItemRatingDetailArrayList, oLeaveFeedback.OrderLineItemID)



Additional Resources

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