newbie question!!! TXMLObject

I am trying to insert a xml doc in tamino. The insert happens fine, but when I try to get the
txmlobject.getCollection() and txmlobject.getId() it comes back blank. To me it looks like for some reason the TXMLObject instance is not getting updated after the commit. Here is my testing code. May be I am doing something stupid.

Any help would be appreciated.

Thanks!!!
:frowning:

  
con = TConnectionFactory.getInstance().newConnection(DBURL);
      tran = con.useLocalTransactionMode();
      xmlObjAcc = con.newXMLObjectAccessor(TAccessLocation.newInstance("PortalLogXML"),
                                           TJDOMObjectModel.getInstance());
      System.out.println("Session started");
      PortalSession session = portalloginevent.getPortalSession();

      Element root = new Element("PortalLog");
      Element sessionChild = new Element("SessionInfo");
      Element loginTime = new Element("LoginTime");
      Element gadgets = new Element("Gadgets");
      Element gadget = new Element("Gadget");
      Element alias = new Element("Alias");
      Element gadgetName = new Element("GadgetName");
      Element gadgetHitTime = new Element("HitTime");
      Element logoutTime = new Element("LogOutTime");
      Element duration = new Element("Duration");

      Enumeration en = session.getAttributeNames();

      if(en==null)
      {
        System.out.println("Enum is null");
      }

      root.addContent(sessionChild);
      sessionChild.addContent(loginTime);
      sessionChild.addContent(gadgets);
      gadgets.addContent(gadget);
      gadget.addContent(alias);
      gadget.addContent(gadgetName);
      gadget.addContent(gadgetHitTime);
      sessionChild.addContent(logoutTime);
      sessionChild.addContent(duration);

      int i=0;

      while (en.hasMoreElements() == true)
      {
        String tempName = (String)en.nextElement();
        Element temp = new Element(tempName);
        Object value = session.getAttribute(tempName);
        temp.setText(value.toString());
        sessionChild.addContent(temp);
        i++;
        System.out.println(i + "  Element Name : " + tempName + "==" + value);
      }
      
      TXMLObject txmlobject = TXMLObject.newInstance(root);

      TResponse response = xmlObjAcc.insert(txmlobject);
      tran.commit();


      System.out.println("Response value: " + response.getReturnValue());
      System.out.println("Collection    : " + txmlobject.getCollection());
      System.out.println("Doctype       : " + txmlobject.getDoctype());
      System.out.println("ino:id        : " + txmlobject.getId());
      


      System.out.println("Doc Name: " + xmlObjAcc);

    

Hello Shahid,

I cannot see any obvious problems in your code.
Could you please post your schema definition, and the values which are stored in the Enumeration en = session.getAttributeNames(); ?

When you write “The insert happens fine” do you mean “no Exception occurs”, or “I am sure that the document is successfully inserted into the collection because I can retrieve it with a query” ?

Could you please give some information on your environment?
   - Tamino version (4141, 4111, 3124, etc)
   - Java version (142, 141_03, etc)
   - OS, and so on.
What context is your code running in (App Server, Servlet Engine, etc)?

Thanks,
Trevor.

Here is the output from the statment

System.out.println(i + "  Element Name : " + tempName + "==" + value);  </pre><BR><BR>Session started<BR>1  Element Name : ClientLocale==en<BR>2  Element Name : System.ConfigLastChangeTime==1058824018750<BR>3  Element Name : ContextPath==/nps<BR>4  Element Name : AuthenticationManager.PortalConnection==com.novell.nps.authent<BR>ication.PortalConnection@1b8d17<BR>5  Element Name : SSFlags==1<BR>6  Element Name : PORTAL_LOCALES==[Ljava.util.Locale;@cc176d<BR>7  Element Name : SS.CurrentState==SSOkay<BR>8  Element Name : USERCN==admin<BR>9  Element Name : SecretStore==com.novell.nps.configManager.ObjectConfig@1161136<BR><BR>10  Element Name : System.SessionManager.XSLSupported==false<BR>11  Element Name : BROWSER_LOCALES_STRING==en-,en-US;1.0<BR>12  Element Name : PORTAL_SESSION==com.novell.nps.sessionManager.DefaultPortalSe<BR>ssion@1c3f8fd<BR>13  Element Name : BROWSER_ADDR==111.111.44.11<BR>14  Element Name : PORTAL_HOST_NAME==www.abc.com:81<BR>15  Element Name : DEVICE_TYPE==browser<BR>16  Element Name : BROWSER_PLATFORM==Mozilla/4.0 (compatible; MSIE 6.0; Windows<BR>NT 5.0)<BR>17  Element Name : USERDN==cn=admin,o=fairview<BR>18  Element Name : BROWSER_HOST==SAGXTSDShost<BR>19  Element Name : System.CurrentState==StateLoggedIn<BR>20  Element Name : REQUEST_HEADER=={User-Agent=Mozilla/4.0 (compatible; MSIE 6.0<BR>; Windows NT 5.0), Accept=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, a<BR>pplication/x-shockwave-flash, */*, Connection=Keep-Alive}<BR>21  Element Name : PortalCredentials==com.novell.nps.authentication.LDAPCredenti<BR>als@10fcabf<BR>22  Element Name : BROWSER_LOCALES==[Ljava.util.Locale;@1c7f04d<BR>23  Element Name : SystemSkinName==default<BR>24  Element Name : SSKey==3440161191847725409<BR>25  Element Name : DeviceType==browser<BR>26  Element Name : System.SessionLock==com.novell.nps.ServiceSyncLock@171857c<BR>27  Element Name : System.SessionManager.LoginTime==Mon Jul 21 16:47:08 CDT 2003<BR><BR><BR><BR><B>Once in a while I get this exception, but everything fails at that time. No insert happens.</B><BR><BR>Nested Exception ( com.softwareag.tamino.db.api.common.TAccessFailureException,<BR>tag: JavaTaminoAPI_4_1_4_42_1_1, java: 1.4.1, os: Windows 2000 5.0 ) stacktrace:<BR><BR><BR>Tamino access failure (, Internal API error, Invalid NULL handle)<BR>        at com.softwareag.tamino.db.api.accessor.TAccessFailureVerifier.newAcces<BR>sFailureException(Unknown Source)<BR>        at com.softwareag.tamino.db.api.accessor.TAccessFailureVerifier.verify(U<BR>nknown Source)<BR>        at com.softwareag.tamino.db.api.accessor.TAccessFailureVerifier.verifyIn<BR>sertResponse(Unknown Source)<BR>        at com.softwareag.tamino.db.api.accessor.TXMLObjectAccessorImpl.insert(U<BR>nknown Source)<BR>        at gdk.AuthBean.writeLoginEvent(AuthBean.java:154)<BR>        at gdk.AuthBean.onPortalEvent(AuthBean.java:245)<BR>        at com.novell.nps.event.PortalEventDispatcher.sendToLocalListeners(Porta<BR>lEventDispatcher.java:159)<BR>        at com.novell.nps.event.PortalEventDispatcher.dispatchEvent(PortalEventD<BR>ispatcher.java:120)<BR>        at com.novell.nps.event.PortalEventDispatcher.run(PortalEventDispatcher.<BR>java:79)<BR><BR><BR><BR><B>when I don't get the exception insert happens fine. Here are the System.out and the output in the console.</B><BR><BR><pre class="ip-ubbcode-code-pre">
System.out.println("Collection    : " + txmlobject.getCollection());
System.out.println("Doctype       : " + txmlobject.getDoctype());
System.out.println("ino:id        : " + txmlobject.getId());
System.out.println("root element        : " + root.toString());
  



Collection :
Doctype : PortalLog
ino:id :
root element : [Element: ]
Response value: 0



Appserver: Jrun4 build 47304
tamino : Version 4.1.4
java version “1.4.1” build 1.4.1-b21
OS: win2kServer sp4
Context: /nps

Hello Shahid,

I can’t see any obvious problems with the environment either.
Could you please post the schema you are using?

It would also help if you could post the full code that you are using, so we can reproduce the environment as closely as possible.

(If you don’t want to post these to the public forum you are welcome to e-mail them to me directly. You can find my e-mail address in my profile.)

Thanks,
Trevor.

Just wondering if you had a chance to look at the files that I sent you.

Thanks!!!

I have the same probl