Installing a Perl implementation of SOAP

Nov 25, '02 08:46:41AM

Contributed by: vanetten

The impetus for expending the effort to enable SOAP on Mac OS X had more to do with the new Sherlock 3 SDK than with SOAP specifically. SOAP services are useful for enabling things like all the little buttons in Sherlock (stock quotes, movie listings, yellow pages, whatever). With a SOAP implementation, I can serve up my own services, then with the Sherlock SDK, make a Sherlock Channel to create an interface to it.

Here's more information on SOAP and the Sherlock 3 SDK.

[Editor's note: The remainder of this article covers installing a Perl implementation of the SOAP client/server setup; if you don't know what that means, you probably (like me!) won't derive much benefit from trying to follow the instructions ... in other words, I haven't even considered trying to test this one myself!]

Instructions:

#
# Perl SOAP Client/Server hello world example on Mac OS X
#

#
# Install all of the software
#

# expat
curl -O http://unc.dl.sourceforge.net/sourceforge/expat/expat-1.95.5.tar.gz
tar zxvf expat-1.95.5.tar.gz
cd expat-1.95.5
./configure
make
make check
sudo make install

#
# All of the perl module installations could be done more easily
# with the perl CPAN module, but I feel more comfortable doing it by hand.
#

#
# LWP dependencies
#

# MIME::Base64
curl -O http://www.cpan.org/modules/by-module/MIME/MIME-Base64-2.12.tar.gz
tar zxvf MIME-Base64-2.12.tar.gz
cd MIME-Base64-2.12
perl Makefile.PL
make
make test
sudo make install

# URI
curl -O http://www.cpan.org/modules/by-module/URI/URI-1.22.tar.gz
tar zxvf URI-1.22.tar.gz
cd URI-1.22
perl Makefile.PL
make
make test
sudo make install

# Digest::MD5
curl -O http://www.cpan.org/modules/by-module/Digest/Digest-MD5-2.20.tar.gz
tar zxvf Digest-MD5-2.20.tar.gz
cd Digest-MD5-2.20
perl Makefile.PL
make
make test
sudo make install

# HTML::Tagset
curl -O http://www.cpan.org/modules/by-module/HTML/HTML-Tagset-3.03.tar.gz
tar zxvf HTML-Tagset-3.03.tar.gz
cd HTML-Tagset-3.03
perl Makefile.PL
make
make test
sudo make install

# HTML::Parser
curl -O http://www.cpan.org/modules/by-module/HTML/HTML-Parser-3.26.tar.gz
tar zxvf HTML-Parser-3.26.tar.gz
cd HTML-Parser-3.26
perl Makefile.PL
make
make test
sudo make install

# libnet
curl -O http://www.cpan.org/modules/by-module/Net/libnet-1.12.tar.gz
tar zxvf libnet-1.12.tar.gz
cd libnet-1.12
perl Makefile.PL
answer default "no" to modifying configuration
make
make test
sudo make install

# LWP
curl -O http://www.cpan.org/modules/by-module/LWP/libwww-perl-5.65.tar.gz
tar zxvf libwww-perl-5.65.tar.gz
cd libwww-perl-5.65
perl Makefile.PL
answer all questions with defaults
make
make test
sudo make install

# XML::Parser
curl -O http://www.cpan.org/modules/by-module/XML/XML-Parser-2.31.tar.gz
tar zxvf XML-Parser-2.31.tar.gz
cd XML-Parser-2.31
perl Makefile.PL EXPATLIBPATH=/usr/local/lib EXPATINCPATH=/usr/local/include
make
make test
sudo make install

#
# SOAP dependencies
#

# IO::Stringy
curl -O http://www.cpan.org/modules/by-module/IO/IO-stringy-2.108.tar.gz
tar zxvf IO-stringy-2.108.tar.gz
cd IO-stringy-2.108
perl Makefile.PL
make
make test
sudo make install

# Mail::Field, Mail::Header, Mail::Internet, etc
curl -O http://www.cpan.org/modules/by-module/Mail/MailTools-1.1401.tar.gz
tar zxvf MailTools-1.1401.tar.gz
cd MailTools-1.1401
perl Makefile.PL
make
make test
sudo make install

# MIME::Lite
curl -O http://www.cpan.org/modules/by-module/MIME/MIME-Lite-2.117.tar.gz
tar zxvf MIME-Lite-2.117.tar.gz
cd MIME-Lite-2.117
perl Makefile.PL
make
make test
sudo make install

# MIME::Parser
curl -O http://www.cpan.org/modules/by-module/MIME/MIME-tools-5.411.tar.gz
tar zxvf MIME-tools-5.411.tar.gz
cd MIME-tools-5.411

# SOAP::Lite
curl -O http://www.cpan.org/modules/by-module/XML/SOAP-Lite-0.55.zip
unzip SOAP-Lite-0.55.zip
cd SOAP-Lite-0.55
perl Makefile.PL
answer with defaults
make
make test
sudo make install

# XML::RSS
curl -O http://www.cpan.org/modules/by-module/XML/XML-RSS-0.97.tar.gz
tar zxvf XML-RSS-0.97.tar.gz
cd XML-RSS-0.97
perl Makefile.PL
make
make test
sudo make install

#
# Turn on the web Server
#

Launch "System Preferences"
Select the "Sharing" button
Select the "Personal Web Sharing" checkbox

#
# Write and install the server
#

/Library/WebServer/CGI-Executables/soap_server.cgi

#!/usr/bin/perl -w

use SOAP::Transport::HTTP;

SOAP::Transport::HTTP::CGI
-> dispatch_to('Demo')
-> handle;

package Demo;

sub hi {
return "hello, world";
}

sudo chmod 755 /Library/WebServer/CGI-Executables/soap_server.cgi

#
# Write and install the client
#

~/soap_client.pl

#!/usr/bin/perl -w
use SOAP::Lite;

print SOAP::Lite
-> uri('http://localhost/Demo')
-> proxy('http://localhost/cgi-bin/soap_server.cgi')
-> hi()
-> result;

chmod 755 ~/soap_client.pl

#
# Execute the client
#

Launch /Applications/Utilities/Terminal.app

~/soap_client.pl

#
# Should see something like
#

[TiBook:~] vanetten% ~/soap_client.pl
hello, world[TiBook:~] vanetten%

#
# More info
#

# From the terminal
perldoc SOAP::Lite

# On the net
# http://soaplite.com

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20021125054641535