Updating a Topic on a Web Server

THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO

If your publication resides on a web site, you might prefer not spending your time between Tópico and your FTP software to make frequent updates to the web site. To ease this process, you can setup a small web service that will accept a relative file name and the published topic file content to save them on the server.

THIS TOPIC IS A WORK IN PROGRESS

Creating the Web Service in ASP.NET

To create this web service in ASP.NET, follow these steps:

  1. From within your ASP.NET project, right click on your project in the solution explorer;
  2. From the popup menu, select Add New Item ...;
  3. In the dialog box, select Web Service as the new item template;
  4. Type updatetopic.asmx as the file name;
  5. Click the Add button.

Click the image for a larger view

Programming the Web Service in ASP.NET

The web service needed to update a topic on a server is only a few lines of code. Once you got an empty Web Service template, set the namespace and add the UpdateTopic method, which is highlighted the following VisualBasic.NET code.

VBScript
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="http://www.formedia.ca/topico")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class updatetopic
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function UpdateTopic(ByVal sFileName As String, ByVal sFileXml As String, ByVal sPassword As String) As String
'create xml document
Dim xmldoc As New XmlDocument
Try
If sPassword = "USE_A_STRONG_PASSWORD" Then
'load the xml string
xmldoc.LoadXml(sFileXml)
'save the file
xmldoc.Save(Server.MapPath(sFileName))
'return
Return "ok"
Else
Return "bad password"
End If
Catch ex As Exception
Return "error : " & ex.ToString
End Try
End Function
End Class

VisualStudio 2003 will generate a template that is a bit different but the UpdateTopic method would be the same. Other platforms could also implement the same Web Service.

Setting up Tópico to use the web service

Back in Tópico, follow these steps to configure the Web Service.

  1. Select the Collection tab;
  2. Click the Folders and Urls button;
  3. Enter the online Url of the publication;
  4. Enter updatetopic.asmx as the file name;
  5. Enter the password you set in the Web Service above.

When a Professional Edition user starts the program, Tópico checks if there is a Web Service URL. If there is one, Tópico tries to connect to the Web Service and display the publish to web button on the toolbar.

The relative path is the path you want to topic copied to, relative to the Web Service location. The password is to make sure only you can update the topic.

THESE PAGES ARE STILL UNDER CONSTRUCTION AND DO NOT NECESSARELY REFLECT THE CURRENT VERSION OF TÓPICO

157 / 194