webMethods

webMethods

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.

 View Only
Expand all | Collapse all

How do I get the entire ino:response document or XML respons

  • 1.  How do I get the entire ino:response document or XML respons

    Posted Wed August 07, 2002 05:30 AM

    I’ve successfully used the JAVA API to create a connection and query the default ino:etc collection.

    I get a TResponse object from the xmlObjectAccessor’s query method. There are various methods to get specific parts of the response (for example getReturnValue() or getFirstNonXMLObject())…

    BUT, “How do I get the entire ino:response document or XML response?” That is, I want the complete response document.


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


  • 2.  RE: How do I get the entire ino:response document or XML respons

    Posted Wed August 07, 2002 12:30 PM

    From a TResponse object you can obtain the entire ino:response document by using:-

    TResponse tresp = …
    Document doc = (Document)(tresp.getFirstXMLObject().getDocument()) ;


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


  • 3.  RE: How do I get the entire ino:response document or XML respons

    Posted Thu August 08, 2002 10:40 AM

    Thank you. It worked.

    I initially was getting the following class Exception when I tried to write the document out to an output stream using an XMLWriter class from a proprietary source: :confused:

    Exception java.lang.ClassCastException: org.apache.crimson.tree.XmlDocument

    And after several hours of tracking down the conflict(some jar file had this class hidden away some where) , and looking at alternative way to write out the document, I finally did the following:

    org.w3c.dom.Document doc = (org.w3c.dom.Document)response.getFirstXMLObject().getDocument();

    org.apache.xml.serialize.XMLSerializer serializer = new org.apache.xml.serialize.XMLSerializer();
    serializer.setOutputByteStream(System.out);
    serializer.serialize(doc);

    And, Voila, the response document displayed to the screen. :slight_smile:

    Most Excellent.

    Thanks for the input. :cool:


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


  • 4.  RE: How do I get the entire ino:response document or XML respons

    Posted Thu August 08, 2002 05:22 PM

    To make this complete:
    If you really want to get down to earth, you can always use the TStreamAccessor. With TStreamAccessor a query() returns a TInputStream with everything received from Tamino directly as a stream.


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