Wednesday, December 18, 2013

Unique Request ID in XPath



I had a requirement to generate unique 10 char ids as Request Ids. The Oracle out of the box UID’s are long 32 char ids. The longer it is, the difficult it becomes.
Custom XPath function in java which did the work for me.

  public static String getRandomUniqueId(){
    SecureRandom random = new SecureRandom();
    String id = "";
    while (id.length() !=10)
     id = new BigInteger(50, random).toString(32).toUpperCase();
  return id;
  }

1 comment:

venkat chakka said...

Hi Thomas,

Could you please post in detail, like how to creat custom xpath, how to register that with the soa n jdevloper, how to access that function in .bpel etc etc..


Thanks.