Problem with Process method!

Hi ppl,

I have a problem with the method process. It is said that when a ino:id is found in a document, the document in the Tamino Database will be replaced. If not found a insert will follow.

The following thing is happenening:

I request a document from the database. Then I strip the Tamino ino:id from the document. The “clean” xml document then is updated by some engines from our website. Then I replace the rootnode with “<AFINPRODATA ino:id=”“”&getal&“”“>”) where &getal& is a int. The $getal$ variable is already an excisting ino:ID

After that the xml structure is ok to be put into tamino. But that doesn’t happens. Nothing is being updated. But when I don’t replace the rootnode like above the document is saved with a new ino:id in tamino!!!

here is some code:


Function UpdateXMLStringCheckStringNr
dim XML
XML = request.Cookies(“XMLString”)

'replace afinprodata with afinprodata with ino id

dim getal
getal = int(2)

XML = Replace(XML, “”, “<AFINPRODATA ino:id=”“”&getal&“”“>”)

'create XML documenti
(DOMDocument)
dim AFINPRODATA
Set AFINPRODATA = Server.CreateObject(“MSXML2.DOMDocument”)
AFINPRODATA.async = false
AFINPRODATA.loadXML(XML)

'create connection with Tamino database for update
dim TamX2, myResponse
‘Set myResponse = Server.CreateObject(“MSXML2.DOMDocument”)
Set TamX2 = Server.CreateObject(“TaminoX.TaminoX1”)
TamX2.Initialize()
TamX2.CsDatabaseURL (“http://INFA04/tamino/MijnKluis”)
’ TamX2.StartSession InoUnprotected, InoLockWaitYes
Tamx2.LPagesize(5)
TamX2.ContentType = “text/xml”
TamX2.Encoding = “ISO-8859-1”



set myResponse = TamX2.Process (AFINPRODATA, “/mijnkluis_info”)
TamX2.Commit

End function

notes: mijnkluis_info = collection



PLz, does somebody knows how to solve this problem?

grtz,

[This message was edited by Djenga on 14 Nov 2002 at 13:10.]

In your example you don’t seem get the xml from Tamino and there isn’t much error checking going on. The problem might be that the ino:id attribute is in namespace “ino:” and maybe that namespace isn’t defined in your XML. That would cause a parse error in your loadXML statement, which you wouldn’t see.

Any other error from Tamino during the process is also not reported, so it’s hard to tell what your problem really is.

I have attached a small example of an asp with some error checking that might help you diagnose the real error.

HTH
Example.asp (1.05 KB)

@Bill and all others:

I used your code, yet it doesn’t works fine. The method still inserts a new document instead of updating a document. There are no parse errors.

Here is the code:


Function UpdateXMLStringCheckStringNr
dim XML, getal, AFINPRODATA, TamX2, myResponse, InoUnprotected, InoLockWaitYes

'XML = “<?xml version=""1.0"" encoding=""iso-8859-1"" ?><AFINPRODATA xmlns:ino=”“http://namespaces.softwareag.com/tamino/response2"” ino:id=“”“&request.Cookies(“stringnr”)&”“” />“
XML = XML & request.Cookies(“XMLString”)
'Response.Write XML
'Response.End
'replace afinprodata with afinprodata including ino id
XML = Replace(XML, “”, “<?xml version=""1.0"" encoding=""iso-8859-1"" ?><AFINPRODATA xmlns:ino=”“http://namespaces.softwareag.com/tamino/response2"” ino:id=”“”&request.Cookies(“stringnr”)&“”" >")

'response.Write XML
'response.End
'create XML document and load it with data
Set AFINPRODATA = Server.CreateObject(“MSXML2.DOMDocument”)
AFINPRODATA.async = false

AFINPRODATA.loadXML(XML)

Response.Write AFINPRODATA.xml
'Response.End

'error handling
If AFINPRODATA.parseError.errorCode <> 0 Then
Response.Write( "XML Parse Error code: " & AFINPRODATA.parseError.errorCode & ", reason: " & AFINPRODATA.parseError.reason & " online: " & AFINPRODATA.parseError.line & “
”)
Else
Response.Write (“XML Parsed successfully
”)
End If

'Create connection with Tamino database voor het updaten
Set TamX2 = Server.CreateObject(“TaminoX.TaminoX1”)
TamX2.Initialize()
TamX2.CsDatabaseURL (“http://INFA04/tamino/MijnKluis”)
'TamX2.StartSession InoUnprotected, InoLockWaitYes
Tamx2.LPagesize(5)
TamX2.ContentType = “text/xml”
TamX2.Encoding = “ISO-8859-1”

set myResponse = TamX2.Process (AFINPRODATA, “/mijnkluis_info”)

Response.Write ("Tamino Response: " & myResponse.xml)

TamX2.Commit
End function



BTW: XML is a XMLstring that is retrieved from a document in Tamino. In another function the ino:id is removed because otherwise the web-engines(for making calculations) won’t work. When all data in this string has been updated the string is set into the cookie XMLstring. That string is the one that has to update the document in Tamino where its ino:id is the key.

I myself think that Tamino doesn’t reconize the ino:id correct since it inserts the data in a new document with a new ino:id.

grtz,

[This message was edited by Djenga on 15 Nov 2002 at 09:17.]

Can you please post the result of the statement Response.Write AFINPRODATA.xml
so that we can see what xml is actually being written to Tamino. It might be easier to post the entire response document as you see it once your request is completed.

Does the new inserted record go into the correct collection?

Thanks.

the document is posted in the correct collection, with a new ino:id

here the code:

<?xml version="1.0"?>








and here the rest of the results:
XML Parsed successfully


grtz

[This message was edited by Djenga on 15 Nov 2002 at 11:20.]

So it seems that you specify ino:id=4 in the xml and Tamino processes ino:id=4 as expected.

What makes you think there is a problem - forgive me if I’m missing something.

Thanks

sorry bill, my mistake. I was already working with another version of the document that has ino:id=“4”

So when I process this document into tamino, tamino itself replaces that ino:id (ino:id=“4”) with ino:id=“5” what inserts a new document.

grtz,

…OK so lets start again, can you please post a complete set of screen output that really shows the xml with its ino:id attribute and the tamino response that corresponds to the process of that xml. We need a complete set of xml and results to get the cause of your problem…

Thanks

[This message was edited by Bill Leeney on 15 Nov 2002 at 11:38.]

it works!!!

the mistake:
when replacing the AFINPRODATA element, 1 space too much was messing the whole element. so that is why tamino probably was assigning a new ino:id

bad code:
<AFINPRODATA xmlns:ino=““http://namespaces.softwareag.com/tamino/response2"” ino:id=”“”&request.Cookies(“stringnr”)&“”" />“


good code:
<AFINPRODATA xmlns:ino=”“http://namespaces.softwareag.com/tamino/response2"” ino:id=“”“&request.Cookies(“stringnr”)&”“”/>"



Thnx for your help Bill!

grtz,