how to use serialization=xml with .Net?

If I add {?serialization method=‘xml’ ?} to a query (or the prolog), the inoCmd.Query fails with a null pointer exception. If the serialization is removed, the query succeeds, but the result is wrapped with the Tamino wrapper.

How should the result be returned in .Net if this serialization method is used.

Sample code used is:

Sub main()
’ doesn’t work yet - gets null exception on query
Dim inoConn As TaminoConnection
Dim inoDoc As TaminoXmlDocument
Dim inoCmd As TaminoCommand
Dim inoQuery As TaminoQuery
Dim inoIt As TaminoItemIterator
Dim qr As TaminoQueryResponse
Dim controlCollection As String = “Tables”
Dim pyNode As XmlElement
Dim xQuery As String = “{input()/*}”
inoConn = New TaminoConnection(“http://localhost/tamino/AKDOT”)
inoConn.Open(TaminoConnectionMode.AutoCommit)

inoCmd = inoConn.CreateCommand(controlCollection)
inoQuery = TaminoXmlDocument.BuildQuery(“{?serialization method=‘xml’ ?}”, xQuery)
'inoQuery = New TaminoQuery(xQuery)
If IsNothing(inoQuery) Then
Console.WriteLine(“inoQuery is nothing”)
Exit Sub
End If
If IsNothing(inoCmd) Then
Console.WriteLine(“inoCmd is nothing”)
Exit Sub
End If
qr = inoCmd.Query(inoQuery, 0) ’ Null pointer exception here.
If qr.HasData Then
Console.WriteLine(qr.GetSinglePage.OuterXml)
Else
Console.WriteLine(qr.ReturnValue & " " & qr.ErrorText)
End If
End Sub

Douglas Kelly,
Principal Consultant
Software AG, Inc
Sacramento, California

Unfortunately it seems that you have stumbled across an interesting problem in the API. :frowning:

I have opened a SAGSIS (P258183) for this problem. I know what is causing it but would like to come up with a solution that doesn’t require user intervention.

I suspect that QueryStream/QueryReader may be a possible workaround until the API is fixed.

[This message was edited by Mark Kuschnir on 26 October 2004 at 10:52.]