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.

 View Only
  • 1.  Stream Object Model

    Posted Thu October 31, 2002 10:38 AM

    Hi everybody,

    I am trying to insert XML Docs using the Stream Object Model! I get always the same error:

    Reading from character input stream caused problems
    NestedException:http://apache.org/xml/features/nonvalidating/load-external-dtd

    Although if I try to do the same usin DOM Object Model, It works great!

    Thx
    Fady

    Fady Kaddoum


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


  • 2.  RE: Stream Object Model

    Posted Thu October 31, 2002 11:08 AM

    hi fady,

    do you - for testing - print the character stream before inserting?

    you must not do this, as then the stream is “consumed”, that is “read empty”.

    if this is not the case: how do you create the data stream? how do you pass it to the insert method?

    regards,
    andreas f.


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


  • 3.  RE: Stream Object Model

    Posted Thu October 31, 2002 04:14 PM

    Yes you are right, actually I was printing the string to see if the structure of the XML file was Ok. I removed it, and still it is not working!
    Find attached the commented piece of code that might give you an idea on how I am doing to insert the stream.

    Thx

    Fady Kaddoum
    MyCode.txt (568 Bytes)


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


  • 4.  RE: Stream Object Model

    Posted Fri November 01, 2002 06:19 AM

    Hi Fady,

    What kind of error are you getting?

    Here is an example of how to use the stream interface to insert a document.

    import com.softwareag.tamino.db.api.accessor.TStreamAccessor;
    import com.softwareag.tamino.db.api.accessor.TAccessLocation;
    import com.softwareag.tamino.db.api.common.TException;
    import com.softwareag.tamino.db.api.connection.TConnection;
    import com.softwareag.tamino.db.api.connection.TConnectionFactory;
    import com.softwareag.tamino.db.api.objectModel.TXMLObject;
    import java.io.IOException;
    
    public class StreamInsert
    {
    public StreamInsert() throws IOException
    {
    try { 
    //Get Connection to the database
    TConnection connection =   TConnectionFactory.getInstance().newConnection("<Tamino URL>");
    
    //Get the Accessor to the appropriate Collection
    TStreamAccessor accessor = connection.newStreamAccessor(TAccessLocation.newInstance("<Collection>"));
    TXMLObject obj = TXMLObject.newInstance("<test>some stuff</test>");
    accessor.insert(obj);
    connection.close();
    } 
    catch (TException taminoException) {
    taminoException.printStackTrace();
    }
    }
    
    public static void main(String argv[]) throws IOException{
    StreamInsert si = new StreamInsert();
    }
    }



    Regards,
    Puny Sen

    [This message was edited by Puny Sen on 01 Nov 2002 at 05:57.]

    [This message was edited by Puny Sen on 01 Nov 2002 at 05:59.]

    [This message was edited by Puny Sen on 01 Nov 2002 at 06:00.]


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


  • 5.  RE: Stream Object Model

    Posted Sat November 02, 2002 03:38 PM

    Hi,

    Ok will check this first thing in the morning on Monday and will tell you know what will happen!

    Thx a lot
    Fady

    Fady Kaddoum


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


  • 6.  RE: Stream Object Model

    Posted Mon November 04, 2002 11:08 AM

    Hello,

    Well it worked but bizarre!

    I uninstalled Tamino and removed all databses and then installed it again and created a fresh database with a new collection but the same schema. Then I used the SAME code, and there it worked!

    Thx anyway!
    Fad

    Fady Kaddoum


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