As others have pointed out, SOAP is designed to interoperate between disparate systems, however it can be relatively difficult to get something working with a server created in a dynamically typed language like Perl and a client in a more strongly typed language such as C# - the temptation to create complex datastructures in Perl for instance can confound the ability to define a class into which it can be deserialized in C#, so the touchstone is to be conservative with the data you are exchanging and to think more in terms of passing documents than objects defined in the respective languages.
Also the .NET web services framework really does prefer that your services are defined in a WSDL document, so if you are able to create one for your Perl server then you are going to find it easier to create your client using for instance the wsdl tool supplied.
All that said a C# client for a simple service that just returns a single string is going to be as simple as:
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
+
[System.Web.Services.WebServiceBinding(Namespace="http://tempuri.org/H
+ello"),
public class Hello : SoapHttpClientProtocol {
+
public Hello () {
this.Url = "http://yoururl/cgi-bin/hello.pl";
}
+
+
[SoapDocumentMethod("http://tempuri.org/Hello/HelloWorld")]
public virtual string HelloWorld() {
System.Object[] results = this.Invoke("HelloWorld", new object
+[0]);
return ((string)(results[0]));
}
+
+
public static void Main()
{
Hello foo = new Hello();
Console.WriteLine(foo.HelloWorld());
}
}
Aplogies for the untested non-Perl code. YOur Perl server could be something like:
#! /usr/bin/perl
use strict;
use SOAP::Transport::HTTP;
+
use lib '/var/www/cgi-bin/soap_modules';
+
use Hello;
+
SOAP::Transport::HTTP::CGI
-> dispatch_to( 'Hello')
-> handle;
With a Hello.pm that is simply:
package Hello;
+
sub HelloWorld
{
return ("Hello, World");
}
+
1;
/J\ |