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.  TResponse :: getFirstXMLObject()

    Posted 07/12/02 11:03 AM

    Hi! It’s me again! :smiley:

    A small question to ask this time:

    if(response.hasFirstXMLObject())
    {
    StringWriter stringWriter = new StringWriter();
    response.getFirstXMLObject().writeTo(stringWriter);
    System.out.println("Retrieve following instance: ");
    System.out.println(stringWriter);
    }
    else
    System.out.println(“No instance found”);

    This small part of the codes, does it just store only the first result? If my query statement suppose to return 3 results, will the program show it, even though they are far apart?

    -KAren-
    :o


    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs


  • 2.  RE: TResponse :: getFirstXMLObject()

    Posted 07/12/02 12:24 PM

    Hi,
    If I understand your question correctly, you need to iterate through your response like this:

    <BR>if ( response.hasFirstXMLObject() ) {<BR>  TXMLObjectIterator myIterator = response.getXMLObjectIterator();<BR>  while (myIterator.hasNext()) {<BR>  TXMLObject xmlObjectReturned = myIterator.next();<BR>... process each xmlObjectReturned here ...<BR>  }<BR>}<BR>

    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs


  • 3.  RE: TResponse :: getFirstXMLObject()

    Posted 07/13/02 04:01 AM

    Heya Bill,

    By using TXMLObjectIterator, it is better than before. It return 3 instances, which is correct. Unfortunately, those 3 instances are the same, ie: 19, 19, 19

    By right, it should show: 19, 45, 88

    I was thinking why it kept reading ID 19. Does it affect if these 3 ID are found in different document? Meaning, all 3 IDs have different ino:id.

    A little background:
    The data I have is actually stored in a single xml file. When I tried to upload it using Tamino Interactive Interface, it went timeout. My guess was, the file was too big, so I broke it up into 4 parts. As I uploaded them one by one, each file have different ino:id.

    Do you think that is why is not reading the other IDs?? Then again, the program returned 3 instances…hmmm??

    -KAren-
    :confused:


    #API-Management
    #webMethods
    #webMethods-Tamino-XML-Server-APIs


  • 4.  RE: TResponse :: getFirstXMLObject()

    Posted 07/13/02 05:55 AM

    Hi again,

    I may be wrong on the ino:id. My second guess is the response.getFirstXMLObject(), for it only retrieve the first object.

    if(response.hasFirstXMLObject())
    {
    TXMLObjectIterator myIterator = response.getXMLObjectIterator();
    System.out.println("Retrieve following instance: ");
    response.getFirstXMLObject().writeTo(stringWriter);

    while (myIterator.hasNext())
    {
    TXMLObject xmlObjectReturned = myIterator.next();
    response.getFirstXMLObject().writeTo(stringWriter);
    count++;
    }
    }
    else
    System.out.println(“No instance found”);

    -KAren-


    #webMethods-Tamino-XML-Server-APIs
    #API-Management
    #webMethods


  • 5.  RE: TResponse :: getFirstXMLObject()

    Posted 07/15/02 01:46 PM

    I reckon your second guess is right.

    TXMLObject xmlObjectReturned = myIterator.next();
    xmlObjectReturned.writeTo(stringWriter);

    should work.


    #webMethods-Tamino-XML-Server-APIs
    #webMethods
    #API-Management