cancel
Showing results for 
Search instead for 
Did you mean: 

Need to xpose odata service to client

Former Member
0 Kudos

hi all,

         iam new to hana platform, i have webservice which is xposed to client, please see the code below i want replicate that in hana, is that possible.

Sub CreateXML()

        Dim spTA As New sp_GETXML_WSTableAdapter

        Dim spTB As dsTradenet.sp_GETXML_WSDataTable = spTA.GetData("TW-2461")

        Dim spPTA As New sp_GETXML_WS_PRODTableAdapter

        Dim spPTB As dsTradenet.sp_GETXML_WS_PRODDataTable

        Dim dr As DataRow

        Dim dp As DataRow

        Dim doc As XmlDocument = New XmlDocument()

        Dim docNode As XmlNode = doc.CreateXmlDeclaration("1.0", "UTF-8", Nothing)

        doc.AppendChild(docNode)

        Dim enqNode As XmlNode = doc.CreateElement("ENQUIRIES")

        doc.AppendChild(enqNode)

        Dim allNode As XmlNode = doc.CreateElement("ALL")

        enqNode.AppendChild(allNode)

        For Each dr In spTB.Rows

            Dim recNode As XmlNode = doc.CreateElement("REPREC")

            allNode.AppendChild(recNode)

            For x As Integer = 0 To dr.Table.Columns.Count - 1

                Dim r As XmlNode = doc.CreateElement(dr.Table.Columns(x).ColumnName)

                r.AppendChild(doc.CreateTextNode(cnn(dr.Item(x))))

                recNode.AppendChild(r)

            Next

            spPTB = spPTA.GetData(dr.Item("DOCREF"))

            For Each dp In spPTB.Rows

                Dim prodNode As XmlNode = doc.CreateElement("PRODUCTS")

                For y As Integer = 0 To dp.Table.Columns.Count - 1

                    Dim p As XmlNode = doc.CreateElement(dp.Table.Columns(y).ColumnName)

                    p.AppendChild(doc.CreateTextNode(dp.Item(y)))

                    prodNode.AppendChild(p)

                Next

                recNode.AppendChild(prodNode)

            Next

        Next

        doc.Save("c:\temp\doc.xml")

    End Sub

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

Is your question how you expose an OData service on HANA or how you create an XML? Your coding just creates an XML.

Regards,

Florian

Former Member
0 Kudos

hi Florian,

                Good day, yes i need to expose the odata, but the data should be built from above logic.

pfefferf
Active Contributor
0 Kudos

Don't really understand that. Why you wanna build an XML and expose it via an OData service. As far as I can see from the coding, there is just a table affected which data is written to an XML. So why not just defining an OData service for the entity. You would be able to consume it as AtomXML or as JSON. Details: Data Access with OData in SAP HANA XS - SAP HANA Developer Guide for SAP HANA Studio - SAP Library