Skip to main content
Published: July 26 2006, 8:48:00 PMUpdated: November 28 2020, 2:16:43 PM

I am passing an UUID that generated with AddItemCall.newUUID() method to my AddItem call but I am getting the following exception: com.ebay.sdk.ApiException: The UUID can only contain Numbers and Letters from A to F and must be 32 characters long . Why?

You can only pass Numbers and Letters characters to Item.UUID parameter. You should not just directly plug the UUID returned from AddItemCall.newUUID() method into Item.UUID property since the method uses Axis UUIDGenFactory to generate an UUID, which contains '-' character, without filtering out the '-' character.
The removing '-' routine is provided for you in the AddItemCall.newUUID() method, you can modify the method, compile and archive the ebaycalls.jar library as below:

JAVA SDK ( old and new versions),

1. Modify AddItemCall.newUUID() method (in ${JAVA_SDK_HOME}/source/apiCalls/src/com/ebaysdk/call the directory). The modified method should be:

public static UUIDType newUUID() {
String uuid = org.apache.axis.components.uuid.UUIDGenFactory.getUUIDGen(null).nextUUID();
StringBuffer goodUuid = new StringBuffer();
for(int i = 0; i < uuid.length(); i ++)
char c = uuid.charAt(i);
if( c != '-' )
return new UUIDType(goodUuid.toString())
//return new UUIDType(uuid);


2. build and archive the apiCalls libraty:
% cd ${JAVA_SDK_HOME}/source/apiCalls/src/com/ebaysdk/call
% ant

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