Troubles using AddFixedPriceItem
Hello,
I'm having troubles using the AddFixedPriceItem metod. After calling i catch an error saying: com.ebay.app.pres.service.hosting.WebServiceDisabl edException: The web service eBayAPI is not properly configured or not found and is disabled.
My code is as listed below, the only thing missing is some kind af FixedPrice property so i'm using StartPrics and BuyItNowPrice.....
Hope someone can help me :-)
Thanks a lot
Henning
// Sandbox Keys
const string sDevIdSandbox = "b8be0bbf-fb9f-4674******************";
const string sAppIdSandbox = "Netflise-7af1-41a4******************";
const string sCertIdSandbox = "5474e917-c93f-4b7e******************";
const string sUserTokenSandbox = "AgAAAA**AQAAAA**aAAAAA**Gf2********************** **";
public void SkubVarerTilEbayHandelsplatform(int iMode, string sDatabaseSrc, string sHTMLdescriptionSRC)
{
// iMode 0 = Sandbox, iMode 1 = Production
// sDatabaseSrc = sti til AccessDatabase
// sHTMLdescriptionSRC = sti til beskrivende HTML-fil....
eBayAPIInterfaceService eBayAPI = new eBayAPIInterfaceService();
OleDbConnection AccessConn = new OleDbConnection();
OleDbCommand AccessCmd = new OleDbCommand();
OleDbCommand AccessCmd2 = new OleDbCommand();
OleDbDataReader readerAccess;
string sUserName = "";
string sPassWord = "";
if (iMode == 0)
{
sUserName = "TESTUSER_NetfliserDK";
sPassWord = "********";
}
else
{
sUserName = "NetfliserDK";
sPassWord = "********";
}
#region åbn access database
string connectionStringAccess = "Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data Source=" + sDatabaseSrc;
AccessConn = new OleDbConnection(connectionStringAccess);
AccessConn.Open();
#endregion åbn access database
// Set credentials
eBayAPIInterfaceService service = new eBayAPIInterfaceService();
service.RequesterCredentials = new CustomSecurityHeaderType();
//service.RequesterCredentials.eBayAuthToken = ConfigurationManager.AppSettings["UserToken"];
service.RequesterCredentials.Credentials = new UserIdPasswordType();
service.RequesterCredentials.Credentials.Username = sUserName;
service.RequesterCredentials.Credentials.Password = sPassWord;
ApiContext context = new ApiContext();
context.ApiCredential.eBayToken = sUserName; // "NetfliserDK";
context.ApiCredential.eBayAccount.UserName = sUserName;
context.ApiCredential.eBayAccount.Password = sPassWord;
context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";
context.XmlApiServerUrl = "https://api.sandbox.ebay.com/wsapi";
context.EPSServerUrl = "https://api.sandbox.ebay.com/wsapi";
service.Url = "https://api.sandbox.ebay.com/wsapi";
service.RequesterCredentials.Credentials.AppId = sAppIdSandbox;
service.RequesterCredentials.Credentials.DevId = sDevIdSandbox;
service.RequesterCredentials.Credentials.AuthCert = sCertIdSandbox;
service.RequesterCredentials.Credentials.Any = null;
service.RequesterCredentials.eBayAuthToken = sUserTokenSandbox;
service.Timeout = 10000;
context.Version = "673";
context.Site = SiteCodeType.UK;
//create the call object
AddFixedPriceItemCall AddFPItemCall = new AddFixedPriceItemCall(context);
//Send UUID with the request
AddFPItemCall.AutoSetItemUUID = true;
AddFPItemCall.ApiContext.SoapApiServerUrl = service.Url;
ItemType item = new ItemType();
//set the item condition depending on the value from GetCategoryFeatures
item.ConditionID = 1000; //new with tags
//Basic properties of a listing
item.Country = CountryCodeType.DK;
item.Currency = CurrencyCodeType.DKK;
string serverUrl = "";
string userToken = "";
serverUrl = service.Url;
userToken = context.ApiCredential.eBayAccount.UserName;
#region Klargør logging mod eBay
context.ApiLogManager = new ApiLogManager();
context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", true, true, true));
context.ApiLogManager.EnableLogging = true;
#endregion Klargør logging mod eBay
#region loop gennem varer og kald Ebay API
string AccessSQL = "";
AccessSQL = "SELECT Type, Varenummer, ArtikelNavn, DetailUdsalgspris, Billede1, minibillede, AccessId, StkPrM2, StkPrPalle FROM JyllandFynFliser WHERE onEbay = true";
AccessCmd = new OleDbCommand(AccessSQL, AccessConn);
readerAccess = AccessCmd.ExecuteReader();
//AddItemRequestType AddItemRequest = new AddItemRequestType();
AddFixedPriceItemRequestType AddFixedPriceItemRequest = new AddFixedPriceItemRequestType();
while (readerAccess.Read())
{
#region Opsæt parametre for denne vare
AddFixedPriceItemRequest.Item = new ItemType();
AddFixedPriceItemRequest.Item.Title = readerAccess.GetValue(2).ToString();
AddFixedPriceItemRequest.Item.SellerContactDetails = new AddressType();
AddFixedPriceItemRequest.Item.SellerContactDetails .CompanyName = "www.netfliser.dk";
AddFixedPriceItemRequest.Item.BuyItNowPrice = new AmountType();
AddFixedPriceItemRequest.Item.StartPrice = new AmountType();
AddFixedPriceItemRequest.Item.BuyItNowPrice.curren cyID = CurrencyCodeType.DKK;
AddFixedPriceItemRequest.Item.StartPrice.currencyI D = CurrencyCodeType.DKK;
AddFixedPriceItemRequest.Item.BuyItNowPrice.Value = Convert.ToDouble(readerAccess.GetValue(3));
AddFixedPriceItemRequest.Item.StartPrice.Value = Convert.ToDouble(readerAccess.GetValue(3));
AddFixedPriceItemRequest.Item.PictureDetails = new PictureDetailsType();
AddFixedPriceItemRequest.Item.PictureDetails.Galle ryType = GalleryTypeCodeType.None;
AddFixedPriceItemRequest.Item.PictureDetails.Galle ryTypeSpecified = true;
#endregion Opsæt parametre for denne vare
#region push at eBay
try
{
service.AddFixedPriceItem (AddFixedPriceItemRequest);
}
catch (Exception e)
{
// ToDo something with error....
string str;
str = e.Message.ToString();
} |