【问题标题】:Ebay API GetCategorySpecifics Error 500Ebay API GetCategorySpecifics 错误 500
【发布时间】:2016-11-10 23:34:18
【问题描述】:

在检查了许多不同的选项之后,我认为是时候向专家提问了:)。

我正在尝试使用 GetCategorySpecifics 调用进行 eBay API 服务调用,但我不断收到以下错误消息:

The remote server returned an error: (500) Internal Server Error.

这是我的代码

//Create the XML File
public string CreateEbayXMLFile()
 { 
        string _ebayFeatureNS = "urn:ebay:apis:eBLBaseComponents";
        string resultXml = "";
        XDocument doc = new XDocument
        (
            new XDeclaration("1.0", "utf-8", ""),
            new XElement(_ebayFeatureNS + "GetCategorySpecifics",
            new XElement(_ebayFeatureNS + "CategorySpecific", true),
            new XElement(_ebayFeatureNS + "CategoryID", "CategoryID"),
            new XElement(_ebayFeatureNS + "FeatureID", "ItemSpecificsEnabled"),
            new XElement(_ebayFeatureNS + "ViewAllNodes", true),
            new XElement(_ebayFeatureNS + "DetailLevel", "ReturnAll"),
            new XElement(_ebayFeatureNS + "CategorySpecificsFileInfo", "true"),
            new XElement(_ebayFeatureNS + "ExcludeRelationships", "false"),
            new XElement(_ebayFeatureNS + "IncludeConfidence", "true"),
            new XElement(_ebayFeatureNS + "MaxNames"),
            new XElement(_ebayFeatureNS + "OutputSelector", "UnitPriceInfo")
            )
       );
    resultXml = doc.ToString();
    return resultXml;
 }

  //Make the Service Call
   public XmlDocument MakeTheServiceCall()
    {
       string localEbayXml = CreateEbayXMLFile();
       string _ebaySvcUrl = http://svcs.ebay.com/services/search/FindingService/v1;

      //Authentication and service call
       byte[] Xml_bytes = Encoding.UTF8.GetBytes(localEbayReqXml);
                HttpWebRequest req = (HttpWebRequest)System.Net.WebRequest.Create(_ebaySvcUrl) as HttpWebRequest;
                req.Headers.Add("X-EBAY-SOA-SECURITY-APPNAME", myAppId);
                req.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "GetCategorySpecifics");
                req.Headers.Add("X-EBAY-SOA-SERVICE-VERSION", "1.0.0");
                req.Headers.Add("X-EBAY-SOA-GLOBAL-ID", "EBAY-US");
                req.Method = "POST";
                req.ContentLength = Xml_bytes.Length;
                req.ContentType = "text/xml";

                using (var requestStream = req.GetRequestStream())
                {
                    requestStream.Write(Xml_bytes, 0, Xml_bytes.Length);
                }

                XmlDocument xmlDoc = new XmlDocument();

                using (HttpWebResponse response = (HttpWebResponse)req.GetResponse())
                {
                    {
                        xmlDoc.Load(response.GetResponseStream());
                    }
                }

    }

我收到了有关 HttpWebResponse 声明的错误消息。它永远不会到达 xmlDoc.Load(response.GetResponseStream());

请帮忙!

【问题讨论】:

    标签: c# asp.net ebay-api


    【解决方案1】:

    我把网址改成https://api.ebay.com/ws/api.dll,问题就解决了。所以而不是:

       string _ebaySvcUrl = http://svcs.ebay.com/services/search/FindingService/v1;
    

    这是

       string _ebaySvcUrl = http://svcs.ebay.com/MerchandisingService
    

    前者可以与findCompletedItemsfindItemsByKeywords 等服务一起使用。

    有关其他一些 url 的列表以及何时使用它们,请参阅下面的链接:

    https://ebaydts.com/eBayKBDetails?KBid=429

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-18
      • 1970-01-01
      • 2017-05-17
      相关资源
      最近更新 更多