December 2001
Intermediate to advanced
264 pages
5h 59m
English
This appendix contains the source code to the many example programs developed throughout the book. To explain the programs, we often presented them piece by piece, sometimes omitting repetitive sections. Example C-1 through Example C-54 are the full programs: intact, unabridged, in all their glory. You can also download them from the web at http://www.oreilly.com/catalog/progwebsoap/.
Example C-1. HelloWorld.pm (server)
package Hello;
sub sayHello {
shift;
my $self = "Hello " . shift;
}
1;Example C-2. HelloWorld.cgi (server)
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('Hello::(?:sayHello)')
-> handle
;Example C-3. HelloWorldClient.pm (client)
use SOAP::Lite;
my $name = shift;
print "\n\nCalling the SOAP Server to say hello\n\n";
print "The SOAP Server says: ";
print SOAP::Lite
-> uri('urn:Example1')
-> proxy('http://localhost/cgi-bin/helloworld.cgi')
-> sayHello($name)
-> result . "\n\n";Example C-4. Helloworld.vbs (client)
Dim x, h Set x = CreateObject("MSXML2.DOMDocument") x.loadXML "<s:Envelope 8 xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'8 xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' 8 xmlns:xsd='http://www.w3.org/1999/XMLSchema'><s:Body><m:sayHello 8 xmlns:m='urn:Example1'><name xsi:type='xsd:string'>James</name> 8 </m:sayHello></s:Body></s:Envelope>"8 msgbox x.xml, , "Input SOAP Message" Set h = CreateObject("Microsoft.XMLHTTP") h.open "POST", "http://localhost/cgi-bin/helloworld.cgi" ...Read now
Unlock full access