You are here iC Home > Perl > XML with Perl > SOAP

Perl

5.3 SOAP

09.05.2008
5.2.1 XML::Parser [  up  ] - [ a - z ] - [ search PC ] - [ top ] 5.3.1 SOAP Error Handling

1 Introduction to SOAP
2 Namespaces in SOAP
3 SOAP::Lite
 3.1Construct an object    
 3.2How to debug    
  3.2.1    Debugging Flag
 3.3How to set a timeout (s)    
 3.4Manpage of SOAP::Lite    


SOAP - Simple Object Access Protocol

SOAP Server

Download: → /perl/ files/soap/hibye cgi.txt
#!/usr/bin/perl -w
use strict;

# -- Server
# -- SOAP::Lite -- guide.soaplite.com -- Copyright (C) 2001 Paul Kulchenko --

use SOAP::Transport::HTTP;

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

package Demo;

sub hi(%) {
	my ($class, $who) = @_;
	$who ||= 'SOAP';
	return "Hello, \"$who\" world!";
}

sub bye {
	return "Goodbye, cruel world";
}

sub languages {
	return ("Perl", "C", "sh");
}

5.1   RSS 2.0
5.2   XML RPC
 5.2.1  XML::Parser
5.3   SOAP
 5.3.1  SOAP Error Handling
 5.3.2  SOAP Basic Authorization
 5.3.3  SOAP Array
 5.3.4  Google SOAP
 5.3.5  SOAP Examples
5.4   eBay API
 5.4.1  Example: get Ebay Time

SOAP Client

Download: → /perl/ files/soap/hibye pl.txt
#!/usr/bin/perl -w

# -- Client
# -- SOAP::Lite -- guide.soaplite.com -- Copyright (C) 2001 Paul Kulchenko --

use SOAP::Lite;

print "Content-type: text/plain\n\n";

print SOAP::Lite
  -> uri('http://yoursoaphost.example.org/Demo')
  -> proxy('http://yoursoaphost.example.org/cgi-bin/soap/hibye.cgi')
  -> hi('Reto')
  -> result, "\n";

print SOAP::Lite
  -> uri('http://yoursoaphost.example.org/Demo')
  -> proxy('http://yoursoaphost.example.org/cgi-bin/soap/hibye.cgi')
  -> bye()
  -> result;


Raw XML

POST / HTTP/1.1

TE: deflate,gzip;q=0.3
Connection: TE, close
Accept: text/xml
Accept: multipart/*
Host: localhost:7890
User-Agent: SOAP::Lite/Perl/0.60
Content-Length: 504
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://localhost/Demo#hi"

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Body>
	<namesp1:hi xmlns:namesp1="http://localhost/Demo">
		<c-gensym3 xsi:type="xsd:string">Reto</c-gensym3>
	</namesp1:hi>
</SOAP-ENV:Body>

</SOAP-ENV:Envelope>


Autogenerate SOAP Code

perl /usr/bin/stubmaker.pl "http://e-channel.example.ch/echannel/pub/wsdl/Catalogue.wsdl"



See also:



Advanced search tips
5.2.1 XML::Parser [  up  ] - [ top ] 5.3.1 SOAP Error Handling



[ home ] - [ search ] - [ feedback ]

copyright by reto - created with mytexi