NAME

SOAP::WSDL::Client - SOAP::WSDL's SOAP Client

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 SOAP operation name, and the SOAPAction header is guessed from the first part's namespace and the operation name (which is mostly correct, but may fail). Operation style and body encoding are assumed to be document/literal

Configuration methods

outputxml

 $soap->outputxml(1);

When set, call() returns the raw XML of the SOAP Envelope.

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 appendet charset like in

 text/xml

Default:

 text/xml; charset: utf8

set_trace

 $soap->set_trace(1);
 $soap->set_trace( sub { Log::Log4perl::get_logger()->debug( @_ ) } );

When set to a true value, tracing (via warn) is enabled.

When set to a code reference, this function will be called on every trace call, making it really easy for you to set up log4perl logging or whatever you need.

Features different from SOAP::Lite

SOAP::WSDL does not aim to be a complete replacement for SOAP::Lite - the SOAP::Lite module has it's strengths and weaknesses and SOAP::WSDL is designed as a cure for the weakness of little WSDL support - nothing more, nothing less.

Nonetheless SOAP::WSDL mimics part of SOAP::Lite's API and behaviour, so SOAP::Lite users can switch without looking up every method call in the documentation.

A few things are quite different from SOAP::Lite, though:

SOAP request data

SOAP request data may either be given as message object, or as hash ref (in which case it will automatically be encoded into a message object).

Return values

The result from call() is not a SOAP::SOM object, but a message object.

Message objects' classes may be generated from WSDL definitions automatically - see SOAP::WSDL::Generator::Typelib on how to generate your own WSDL based message class library.

Fault handling

SOAP::WSDL::Client returns a fault object on errors, even on transport layer errors.

The fault object is a SOAP1.1 fault object of the following SOAP::WSDL::SOAP::Typelib::Fault11.

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 SOAP body when outputxml is set to true. SOAP::WSDL::Client returns the complete XML response.

Auto-Dispatching

SOAP::WSDL::Client does 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.pl 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

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: 303 $
 $LastChangedBy: kutterma $
 $Id: Client.pm 303 2007-10-01 18:51:50Z kutterma $
 $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $