IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  Duplicate vs. pointer

    Posted 07/14/08 01:30 PM

    All,

    I have an EDI DELFOR that I am mapping to multiple documents (of the same type). Basically what I do is create a “stub document” with all the common information, then, inside a loop, I copy that to a temporary document via mapping, populate the specific info, save it to a list of outgoing docs, and drop the temporary doc. However, whatever I do to the temporary document also is done to the original “stub.” So on the second time through the loop, whatever I do to the new temp is done to the stub AND to the document in the outgoing list. I know in Java if you say a = b; a becomes just a pointer to the b variable, and so changing one changes both, whereas a == b; would be a more explicit value match. Has anyone ever faced this issue, or know how to truly copy a document, and not create a pointer to it?

    Thanks


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Duplicate vs. pointer

    Posted 07/14/08 04:09 PM

    Two items:

    • Map at the field level, not the record level. Primitive fields are copy by value. Records are copy by reference.

    • Drop the temp var near the end of the loop when you are done with it.

    [Edit] The first bullet is a rule of thumb for string variables. For all other types of variables, IS copies by reference. Refer to the Developer User’s Guide for details, Chapter 8 “Mapping Data in a Flow Service” (v 6.5). That chapter provides information about copy by reference and copy by value, and mapping techniques to get the sort of copy behavior that you need for a given task.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: Duplicate vs. pointer

    Posted 07/14/08 04:28 PM

    Thanks reamon, mapping by field seems to do the trick. That’s a good piece of information to know about how values are copied!


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB