Example server API - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

Add a new class to your project and name it identical to the name of the MethodDef. Put the class in the SPF.Server.Components.Core.APIs namespace and inherit from Server API. At this point your class will look similar to this:

Public Class MyNewServerAPI

Inherits SPF.Server.Components.Core.APIs.ServerAPI

#Region " Constructor "

Public Sub New()

MyBase.New()

End Sub

#End Region

#Region " Methods "

Protected Overrides Sub OnDeSerialize()

'

' Look for objects

'

DeSerializeObjects(CoreModule.Server.Request.SelectSingleNode("Query/Objects"))

End Sub

Protected Overrides Sub OnHandlerBody()

BaseDictionary = ObjectCollection.GetObjects

End Sub

Protected Overrides Sub OnSerialize()

Dim lnodReply As XmlNode = SPFRequestContext.Instance.Response.AppendChild(SPFRequestContext.Instance.Response.CreateElement("Reply"))

End Sub

#End Region

End Class

That is the entire framework needed for the Server API. Included in the example are how to extract the objects from the request XML and how to retrieve those objects from the database.