Mono WebServices - Part 2
On a roll here…
I’ve converted my Mono -> MySQL demo page to exist as web service as well. Essentially the same background code, just with a bit of abstraction and the ASP.NET web service syntactic sugar.
So, now you can read a list of blog entry titles into your own application! Well, as long as your language-of-choice supports DataSets that is.
To re-hash some of the instructions in my previous post:
Generate a proxy client with:
$ wsdl -n:Schwuk http://schwuk.com/wip/titlelist.asmx?wsdl
Save the following as TitleListClient.cs:
using System;
using System.Data;
using Schwuk;
class MainClass
{
public static void Main(string[] args)
{
TitleList ws = new TitleList();
DataSet ds = ws.GetTitles();
foreach (DataRow row in ds.Tables[0 ].Rows)
{
Console.WriteLine(row[1 ]);
}
}
}
I’ve had to include some extra spaces in that code to make Textpattern play nicely…
Compile with:
mcs -r:System.Data -r:System.Web.Services TitleListClient.cs TitleList.cs
That’s it. No MonoDevelop project this time, but you can get a pre-compiled executable if you’re feeling lazy…
Related posts:
Related posts brought to you by Yet Another Related Posts Plugin.
This theme was designed by Chris Wallace and is licensed under the GNU General Public License.
Check out his cool WordPress Themes. Released by Six Revisions in the year of the rat.
look good
Recent comments