DEFINE CLASS firstbizobj AS Session OLEPUBLIC firstname = "" lastname = "" PROCEDURE GetRecord(lnID AS Number) AS Boolean IF SEEK(lnID) this.FirstName = mytable.fname this.LastName = mytable.lname ENDIF RETURN FOUND() PROCEDURE SaveRecord() AS Boolean REPLACE fname WITH this.FirstName, lname WITH this.LastName RETURN ENDDEFINENow, lets create a stateless wrapper for it:
DEFINE CLASS webservicebizobj AS Session OLEPUBLIC oBizObj = .NULL. PROCEDURE Init this.oBizObj = NEWOBJECT('firstbizobj') ENDPROC PROCEDURE GetRecord(lnID AS Number) AS String IF this.oBizObj.GetRecord(lnID) * Create an XML string from the properties in the stateful object lcXML = '< name firstname="' + this.FirstName + '" ' + ; 'lastname="' + this.LastName + '" />' ENDIF RETURN lcXML PROCEDURE SaveRecord(lcXML AS String) AS Boolean * Parse the XML into and save the record this.oBizObj.GetRecord(lnIDfromXML) this.oBizObj.FirstName = lcFirstNamefromXML this.oBizObj.LastName = lcLastNamefromXML this.oBizObj.Save() RETURN ENDDEFINENow the above class should be able to be compiled as a web service, and you can actually write a stateful wrapper for that:
DEFINE CLASS secondbizobj AS Session OLEPUBLIC firstname = "" lastname = "" oWebService PROCEDURE Init this.oWebService = CREATEOBJECT('webservicebizobj') && create the webservice here with the soap client ENDPROC PROCEDURE GetRecord(lnID AS Number) AS Boolean lcXML = this.oWebService.GetRecord(lnID) this.FirstName = lcFirstNamefromXML this.LastName = lcLastNamefromXML RETURN PROCEDURE SaveRecord() AS Boolean lcXML = '< name firstname="' + this.FirstName + '" ' + ; 'lastname="' + this.LastName + '" />' this.oWebService.SaveRecord(lcXML) RETURN ENDDEFINELooks like it can be done. I recommend actually creating stateless web services, and using them as stateless objects, but I suppose this doesn't hurt.