views:

34

answers:

0

Hi. Do you have an example on how to populate an SIMILE/Exhibit from a ASP.NET webService? I need to return records from a SQL database.

Here is my webservice (Exhibit2.asmx):

<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Exhibit2
    Inherits System.Web.Services.WebService
<WebMethod()> _
<Script.Services.ScriptMethod(ResponseFormat:=Script.Services.ResponseFormat.Json, XmlSerializeString:=True)> _
 Public Function GetData() As String
  Dim result As String = String.Empty
  Using db As New dataDataContext
     ' Table Fields: ID, Name, DateOfBirth, Address, City, Phone
     Dim r = (From i In db.Persons Select i).ToList
     Dim j As New Script.Serialization.JavaScriptSerializer()
     result = j.Serialize(r)
  End Using
  Return result  
 End Function
End Class

This is the page code (Exhibit1.htm):

<html>
 <head>
  <title>MIT Nobel Prize Winners</title>

  <link href="Exhibit2.asmx/GetData" type="application/json" rel="exhibit/data" />

  <script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js"
        type="text/javascript"></script>
 </head> 
 <body>
  <h1>Test SIMILE/Exhibit</h1>
  <table width="100%">
    <tr valign="top">
        <td ex:role="viewPanel">
            <div ex:role="view"></div>
        </td>
        <td width="25%">
            browsing controls here...
        </td>
    </tr>
  </table>
 </body>
</html>

I need to format the resulting json in a way that Exhibit can understand.