调用eBay VerifyAddFixedPriceItem接口时XML请求多次报错的修正咨询
调用eBay VerifyAddFixedPriceItem接口时XML请求多次报错的修正咨询
看起来你遇到了两个典型的XML格式与接口参数规范问题,咱们一步步拆解解决:
1. 解决错误Code 20170(Schema XML反序列化错误)
这个错误的核心原因是XML命名空间存在非法字符,导致eBay的Schema解析器无法正确识别你的请求结构。
你当前XML根元素的命名空间里有个多余的*号:
xmlns="urn:eb*y:apis:eBLBaseComponents"
必须把eb*y改成ebay,修正后的合法命名空间为:
xmlns="urn:ebay:apis:eBLBaseComponents"
这个非法字符会直接让解析器无法匹配官方Schema,进而抛出"SimpleDeserializer encountered a child element"这类反序列化异常。
2. 解决错误Code 37(PictureURL格式无效)
eBay的PictureURL字段强制要求完整的HTTP/HTTPS协议前缀,你去掉http://的操作刚好违反了参数规范。
正确的写法必须保留协议头,比如你最初的URL格式就是合规的:
<PictureURL>http://www.mensworld.com.bd/wp-content/uploads/2023/09/FSF-1166.jpg</PictureURL>
如果该图片支持HTTPS,换成https://会更稳妥,但核心是必须包含完整的协议前缀,同时要确保这个URL是公开可访问的(eBay会验证图片的可访问性)。
修正后的完整XML示例
<?xml version='1.0' encoding='utf-8'?> <VerifyAddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <RequesterCredentials> <eBayAuthToken>v^1.1#i^1#r^1#I^3#p^3#f^0#t^Ul4xMF84Ojg0NUNBQzJCAAAAAABBBBBBBBBBBCCCCCFAKE=</eBayAuthToken> </RequesterCredentials> <Item> <ConditionID>1500</ConditionID> <Country>US</Country> <Currency>USD</Currency> <Description>Genuine leather jacket in excellent condition</Description> <DispatchTimeMax>3</DispatchTimeMax> <ItemSpecifics> <NameValueList> <Name>Brand</Name> <Value>Custom</Value> </NameValueList> <NameValueList> <Name>Size (Men's)</Name> <Value>L</Value> </NameValueList> <NameValueList> <Name>Color</Name> <Value>Yellow</Value> </NameValueList> <NameValueList> <Name>Style</Name> <Value>Basic Coat</Value> </NameValueList> <NameValueList> <Name>Type</Name> <Value>Leather Jacket</Value> </NameValueList> <NameValueList> <Name>Material</Name> <Value>Leather</Value> </NameValueList> <NameValueList> <Name>Pattern</Name> <Value>Solid</Value> </NameValueList> <NameValueList> <Name>Department</Name> <Value>Men</Value> </NameValueList> </ItemSpecifics> <ListingDuration>Days_7</ListingDuration> <ListingType>FixedPriceItem</ListingType> <Location>San Jose, CA</Location> <PictureDetails> <PictureURL>http://www.mensworld.com.bd/wp-content/uploads/2023/09/FSF-1166.jpg</PictureURL> </PictureDetails> <PostalCode>95125</PostalCode> <PrimaryCategory> <CategoryID>57988</CategoryID> </PrimaryCategory> <Quantity>1</Quantity> <ReturnPolicy> <RefundOption>MoneyBack</RefundOption> <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption> <ReturnsWithinOption>Days_30</ReturnsWithinOption> <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption> </ReturnPolicy> <ShippingDetails> <ShippingServiceOptions> <ShippingService>USPSPriority</ShippingService> <ShippingServiceCost> <currencyID>USD</currencyID> <value>0.00</value> </ShippingServiceCost> <ShippingServicePriority>1</ShippingServicePriority> </ShippingServiceOptions> <ShippingType>Flat</ShippingType> </ShippingDetails> <Site>US</Site> <StartPrice> <currencyID>USD</currencyID> <value>99.00</value> </StartPrice> <Title>Yellow Leather Jacket</Title> </Item> </VerifyAddFixedPriceItemRequest>
备注:内容来源于stack exchange,提问作者Fredy
相关产品推荐
相关产品推荐

