Skip to Content

GUID conversion and assigning to a node element

Hi All,

I have a GUID from my back end which I want to hard code in my webdynpro application. This GUID will later be transferred back to the back end. Do anyone has any sample code to assign the guid to a node element of type binary. From the back end system, I have the GUID of type RAW "41FAF49741FE0A1DE10000000A114B54". When the model is imported into the web dynpro application, the GUID type is taken as binary. I want to set this value "41FAF49741FE0A1DE10000000A114B54" to my node. Can anyone help me with this?

Thanks for your help.

Best Regards,

Hemanth

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2005 at 03:26 AM

    Hi Hemanth

    I assume the binary attribute will be a byte array.

    You can create a string using the string constructor that takes in the byte array and there are string methods that give back the byte array. If wdContext.currentSomeElement().getBin() is a binary attribute then

    //converted byte array to string
    String strBinary = new String(wdContext.currentSomeElement().getBin());
    //converted string to byte array 
    byte b[] = strBinary.getBytes();

    Regards

    Pran

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Hemanth Garg

      Hi Hermanth,

      for simply hardcoding, you could do something like this:

      final byte[] hardcodedGUID = new byte[] { 
        0x41, 0xFA, 0xF4, 0x97, 
        0x41, 0xFE, 0x0A, 0x1D, 
        0xE1, 0x00, 0x00, 0x00, 
        0x0A, 0x11, 0x4B, 0x54
      };
      wdContext.current<YourBinaryElement>().set<yourBinaryAttr>(hardcodedGUID);

      Hope that helps.

      Regards

      Stefan

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.