业务: 将一些ebay上的Ads的Startprice进行更新。
核心代码:
ItemType item = new ItemType(); AmountType start = new AmountType(); start.setValue(startPrice); item.setStartPrice(start); item.setItemID(ebayItemNumber); ReviseItemCall call = new ReviseItemCall(); call.setApiContext(apiContext); call.setItemToBeRevised(item); call.reviseItem(); out.println(call.getRequestXml()); out.println("--------"); out.println(call.getResponseXml());
出现能够将Startprice进行更新。但是ReturnPolicy中的Detail被清空了
因此使用:call.getRequestXml()和call.getResponseXMl()来查看
信息如下:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header> <ebl:RequesterCredentials xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:mustUnderstand="0"> <ebl:eBayAuthToken>XXXXXXXXXXXXXXXXXXXXXXX</ebl:eBayAuthToken> </ebl:RequesterCredentials> </S:Header> <S:Body> <ReviseItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <Version>747</Version> <Item> <ItemID>180931471196</ItemID> <StartPrice>334.01</StartPrice> </Item> </ReviseItemRequest> </S:Body> </S:Envelope> -------- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <ReviseItemResponse xmlns="urn:ebay:apis:eBLBaseComponents"> <Timestamp>2012-07-23T02:46:32.208Z</Timestamp> <Ack>Success</Ack> <Version>783</Version> <Build>E783_CORE_BUNDLED_15095068_R1</Build> <ItemID>180931471196</ItemID> <StartTime>2012-07-17T22:06:33.000Z</StartTime> <EndTime>2012-07-24T22:06:33.000Z</EndTime> <Fees> <Fee> <Name>AuctionLengthFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>BoldFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>BuyItNowFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>CategoryFeaturedFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>FeaturedFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>GalleryPlusFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>FeaturedGalleryFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>FixedPriceDurationFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>GalleryFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>GiftIconFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>HighLightFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>InsertionFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>InternationalInsertionFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>ListingDesignerFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>ListingFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>PhotoDisplayFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>PhotoFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>ReserveFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>SchedulingFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>SubtitleFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>BorderFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>ProPackBundleFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>BasicUpgradePackBundleFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>ValuePackBundleFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>PrivateListingFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>ProPackPlusBundleFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> <Fee> <Name>MotorsGermanySearchFee</Name> <Fee currencyID="USD">0.0</Fee> </Fee> </Fees> </ReviseItemResponse> </soapenv:Body> </soapenv:Envelope>
通过Request和Response没有发现问题。因此在ReviseItem中干脆将ReturnPolicy重新封装上去ebay源码如下:
public ReturnPolicyType getReturnPolicy() { ReturnPolicyType returnPolicy = new ReturnPolicyType(); ReturnsAcceptedOptionsCodeType returnsAcceptedOption = ReturnsAcceptedOptionsCodeType.RETURNS_ACCEPTED; returnPolicy.setReturnsAcceptedOption(returnsAcceptedOption.value()); //set refund RefundOptionsCodeType refundOption = RefundOptionsCodeType.EXCHANGE; returnPolicy.setRefundOption(refundOption.value()); //set with in ReturnsWithinOptionsCodeType returnsWithinOption = ReturnsWithinOptionsCodeType.DAYS_14; returnPolicy.setReturnsWithinOption(returnsWithinOption.value()); //set return ship cost by returnPolicy.setShippingCostPaidByOption("Buyer"); //set return detail (description) returnPolicy.setDescription("XXXXXX"); return returnPolicy; }
但是上传至ebay,startPrint可以更新,但是ReturnPolicy detail还是没有了。