Skip to main content
Published: August 21 2006, 9:30:00 AMUpdated: November 28 2020, 2:26:49 PM

Why GetCharitiesCall.getCharityID() returns null 


You are getting null because the CharityID property is an input param for GetCharties API call and it does not exist in the GetCharitiesResponse. The Charity[attribute id ] is the ID property that represents an unique identification of  a Charity organization in the GetCharitiesResponse. So you need to use getId() method to retrieve
the charity Id. The CharityID tag in GetCharitiesRequest is as <Charity id="3856"> and the the Charity[attribute id ] tag in the GetCharitiesResponse is as <Charity id= "3856">.

Please keep in mind that the two IDs basiclly refer to the same property: an unique identification for a Charity orgnizationin .

Detailed Description

The follow code snippet demonstrates using the two IDs in JAVA SDK:

     GetCharitiesCall api = new GetCharitiesCall(apiContext);
     GetCharitiesRequestType req = new GetCharitiesRequestType();
      req.setIncludeDescription(new Boolean(false));
      req.setCharityRegion(new Integer(7));
      // Make API call.
     }catch(Exception e){
     CharityInfoType[] charities = api.getReturnedCharities();
     for (int i =0; i<charities.length; i++){
         CharityInfoType theCharityInfo = charities[i];
         System.out.println(" charityId :" + theCharityInfo.getId());          

 The code snippet  generates the GetCharitiesRequest and GetCharitiesResponse SOAP xml as below:
 <?xml version="1.0" encoding="UTF-8"?>
 <soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
   <ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
    <ebl:eBayAuthToken xmlns:ebl="urn:ebay:apis:eBLBaseComponents">YOUR TOKEN</ebl:eBayAuthToken>
   <GetCharitiesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  Response Message:

<?xml version="1.0" encoding="UTF-8"?>
 <soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">
   <GetCharitiesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
    <Charity id="3856">
     <Name>Starlight Starbright Children's Foundation</Name>
     <Mission>The Starlight Starbright Children's Foundation is dedicated to brightening the lives of seriously ill children and their families through imaginative, resourceful programs and multimedia projects that uplift their spirits to help transcend pain and fear.</Mission>

Version Info

The code example above was based on the versions specified below:

API Schema Version 473
Java SDK Version javasdk v467.0 point release

Additional Resources

How well did this answer your question?
Answers others found helpful