Serializing an array list -- web services

Results 1 to 2 of 2

Thread: Serializing an array list -- web services

  1. #1
    Join Date
    Dec 1969

    Default Serializing an array list -- web services

    *<BR>Hello,<BR><BR> I am working on a web service where I want to return a class having a user defined type arraylist. When I call the web service from the client, I get a message saying I must serialize "not static" (user-defined?) data types.<BR><BR> I searched the web for serializing and found this page but I am not sure if it applies to my situation or not.<BR><BR> Here are the classes I define in my web service<BR><BR> Public Class joborder<BR> Public COMPLIANCE_ID As Integer<BR> Public COMPLIANCE_DATE As DateTime<BR> End Class<BR><BR> Public Class recipient<BR> Public FIRST_NAME As String<BR> Public LAST_NAME As String<BR> Public SENT_VIA As String<BR> Public SENT_TO As String<BR> End Class<BR><BR> Public Class location<BR> Public LOCATION_ID As Integer<BR> Public COMPLIANCE_STATUS As Integer<BR> Public JOBORDERS As New ArrayList // joborders <BR> Public RECIPIENTS As New ArrayList // recipents<BR> End Class<BR><BR> Public Class jobCompliance<BR> Public COMPLIANCE_BATCH_ID As Integer<BR> Public TOTAL_JOBS_IN_BATCH As Integer<BR> Public LOCATIONS As New ArrayList // locations<BR> End Class<BR><BR> I initialize and fill these classes and return an object of type "jobCompliance" in the following function<BR><BR> Public Function getNextComplianceReport() As jobCompliance<BR><BR> How do I use serialization so that when my client calls getNextComplianceReport, it will be able to deserialize jobCompliance object and access its contents?<BR><BR> Thank you,<BR><BR> Burak

  2. #2
    Join Date
    Dec 1969

    Default RE: Serializing an array list -- web services

    The link you showed is a decent example and it is fairly on spot for what you need. I use serialization in my web app, but I use a BinaryFormatter instead of a SoapFormatter. Since you are developing a WebService, I guess SOAP is the way to go for you. In my app, after I call serialize(), I call getBuffer() on my stream and stick the returned byte[] in a session. Seems the example you posted just writes the SOAP to disk. That&#039;s fine, just keep track of the file names. I have done similiar things that write to disk - I use a GUID to name the file - you just need to let the client know what that filename is so it can be used when deserialize() is called.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts