SOAP::WSDL::Client (3)
Leading comments
Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) Standard preamble: ========================================================================
NAME
SOAP::WSDL::Client - SOAP::WSDL's SOAP ClientSYNOPSIS
use SOAP::WSDL::Client; my $soap = SOAP::WSDL::Client->new({ proxy => 'http://www.example.org/webservice/test' }); $soap->call( \%method, $body, $header);
METHODS
call
$soap->call( \%method, \@parts );
%method is a hash with the following keys:
Name Description ---------------------------------------------------- operation operation name soap_action SOAPAction HTTP header to use style Operation style. One of (document|rpc) use SOAP body encoding. One of (literal|encoded)
The style and use keys have no influence yet.
@parts is a list containing the elements of the message parts.
For backward compatibility, call may also be called as below:
$soap->call( $method, \@parts );
In this case, $method is the
Configuration methods
outputxml
$soap->outputxml(1);
When set, call() returns the raw
set_content_type
$soap->set_content_type('application/xml; charset: utf8');
Sets the content type and character encoding.
You probably should not use a character encoding different from utf8: SOAP::WSDL::Client will not convert the request into a different encoding (yet).
To leave out the encoding, just set the content type without appending charset like this:
$soap->set_content_type('text/xml');
Default:
text/xml; charset: utf8
set_prefix
$soap->set_prefix('ns2');
If set, alters the serialization of the request
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:xsi="www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="schemas.xmlsoap.org/soap/envelope"> <SOAP-ENV:Body> <getElementId xmlns="services.exmaple.org"> <elementId>12345</elementId> </getElementId> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
If the sample set_prefix() call above is used prior to calling your
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:xsi="www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="schemas.xmlsoap.org/soap/envelope" xmlns:ns2="services.example.org"> <SOAP-ENV:Body> <ns2:getElementId> <elementId>12345</elementId> </ns2:getElementId> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
This is useful in cases where, for instance, one is communicating with a
Features different from SOAP::Lite
Nonetheless
A few things are quite different from SOAP::Lite, though:
Return values
The result from call() is not a
Message objects' classes may be generated from
Fault handling
SOAP::WSDL::Client returns a fault object on errors, even on transport layer errors.
The fault object is a
SOAP::WSDL::SOAP::Typelib::Fault11 objects are false in boolean context, so you can just do something like:
my $result = $soap->call($method, $data); if ($result) { # handle result } else { die $result->faultstring(); }
outputxml
SOAP::Lite returns only the content of the
Auto-Dispatching
SOAP::WSDL::Client does not support auto-dispatching.
This is on purpose: You may easily create interface classes by using SOAP::WSDL::Client and implementing something like
sub mySoapMethod { my $self = shift; $soap_wsdl_client->call( mySoapMethod, @_); }
You may even do this in a class factory - see wsdl2perl for creating such interfaces.
TROUBLESHOOTING
Accessing protected web services
Accessing protected web services is very specific for the transport backend used.In general, you may pass additional arguments to the set_proxy method (or a list ref of the web service address and any additional arguments to the new method's proxy argument).
Refer to the appropriate transport module for documentation.
LICENSE AND COPYRIGHT
Copyright 2004-2007 Martin Kutter.This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself
AUTHOR
Martin Kutter <martin.kutter fen-net.de>REPOSITORY INFORMATION
$Rev: 851 $ $LastChangedBy: kutterma $ $Id: Client.pm 851 2009-05-15 22:45:18Z kutterma $ $HeadURL: soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $