question

hfseay avatar image
0 Likes"
hfseay asked

Java uses "setshipmenttrackingdetails" to upload the order tracking number and always returns a null pointer exception

I am uploading the "trackingnumber" and "carrier information" to an order using the API interface. I use the "setshippingcarrierused()" and "setshipmenttrackingnumber()" methods in the "shipmenttrackingdetailstype" class in "GetordersCall", but the problem is that when I actually use these two methods, Null pointer exception is always returned, resulting in failure to upload relevant information to the order.Is there a problem with my program or API interface?


1、ShippingDetailsType shippingDetails=new ShippingDetailsType();

2、ShipmentTrackingDetailsType[] shipmentTrackingDetails2 =new ShipmentTrackingDetailsType[2];

3、shipmentTrackingDetails2[1].setShippingCarrierUsed("USPS");

4、shipmentTrackingDetails2[1].setShipmentTrackingNumber("9214490280018523788888");

5、shippingDetails.setShipmentTrackingDetails(shipmentTrackingDetails2);

6、orders[7].setShippingDetails(shippingDetails);



The above is my java code. Every time I run to step 3, an error will be reported. Is the error displayed? Null pointer exception!

carriertrackingnumbersetshipmenttrackingnumber
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sagar_developersupport avatar image
0 Likes"
sagar_developersupport answered

Hi @hfseay,

You need to use to CompleteSale call of Trading API or createShippingFulfillment call Fulfillment API to set the item's shipment tracking information. Please go through the link given below to know more about the calls.
Ref: https://developer.ebay.com/devzone/xml/docs/reference/ebay/CompleteSale.html
https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/methods/createShippingFulfillment

Best Regards,
eBay Developer Support

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hfseay avatar image
0 Likes"
hfseay answered

Thank you very much for your patience. I also studied completesalescall carefully. But my question now is that I have set all the contents in a completecall. How can I upload the corresponding contents to the corresponding order? Here is my code!

1、 ApiContext apiContext = getApiContext();

2、 CompleteSaleCall CompleteSaleCall=new CompleteSaleCall(apiContext);

3、 CompleteSaleCall.setOrderID("018888");

4、 CompleteSaleCall.setItemID("79");

5、 CompleteSaleCall.setTransactionID("87");

6、 ShipmentType shipment =new ShipmentType();

7、 CompleteSaleCall.setShipped(true);

8、 shipment.setShippingCarrierUsed("USP");

9、 shipment.setShipmentTrackingNumber("11");

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.