NAME

XML::Compile::Transport::SOAPHTTP - exchange XML via HTTP

INHERITANCE

XML::Compile::Transport::SOAPHTTP
  is a XML::Compile::Transport

SYNOPSIS

use XML::Compile::Transport::SOAPHTTP;

my $transporter = XML::Compile::Transport::SOAPHTTP->new(@options);
my $class = $transporter->compileClient(@options2);

my ($xmlout, $trace) = $call->($xmlin);
my $xmlout = $call->($xmlin);   # when no trace needed

DESCRIPTION

This module handles the exchange of (XML) messages, according to the rules of SOAP (any version). The module does not known how to parse or compose XML, but only worries about the HTTP aspects.

METHODS

Constructors

XML::Compile::Transport::SOAPHTTP->new(OPTIONS)

    Option    --Defined in     --Default
    address     XML::Compile::Transport  'localhost'
    charset     XML::Compile::Transport  'utf-8'
    user_agent                   <created when needed>

    . address => URI|ARRAY-of-URI

    . charset => STRING

    . user_agent => LWP::UserAgent object

      If you pass your own user agent, you will be able to configure it. Otherwise, one will be created with all the defaults. Providing your own user agents -or at least have a look at the configuration- seems like a good idea.

Accessors

$obj->address

$obj->addresses

$obj->charset

$obj->userAgent([AGENT])

    Returns the User Agent which will be used. You may change the configuration of the AGENT (the returned LWP::UserAgent object) or provide one yourself. See also new(user_agent).

    Changes to the agent configuration can be made before or after the compilation, or even inbetween SOAP calls.

Handlers

$obj->compileClient(OPTIONS)

    Compile an HTTP client handler. Returned is a subroutine which is called with a text represenation of the XML request, or an XML::LibXML tree. In SCALAR context, an XML::LibXML parsed tree of the answer message is returned. In LIST context, that answer is followed by a HASH which contains trace information.

    Option      --Defined in     --Default
    action                         <required>
    header                         <created>
    hook          XML::Compile::Transport  <undef>
    kind          XML::Compile::Transport  'request-response'
    method                         'POST'
    mime_type                      <depends on soap version>
    mpost_id                       42
    soap_version                   'SOAP11'

    . action => URI

    . header => HTTP::Headers object

    . hook => CODE

    . kind => STRING

    . method => 'POST'|'M-POST'

      With POST, you get the standard HTTP exchange. The M-POST is implements the (Microsoft) HTTP Extension Framework. Some servers accept both, other require a specific request.

    . mime_type => STRING

    . mpost_id => INTEGER

      With method M-POST, the header extension fields require (any) number to be grouped.

    . soap_version => 'SOAP11'|'SOAP12'

    example: create a client

    my $trans = XML::Compile::Transport::SOAPHTTP->new
      ( address => 'http://www.stockquoteserver.com/StockQuote'
      );
    
    my $call = $trans->compileClient
      ( action  => 'http://example.com/GetLastTradePrice'
      );
    
    # $request and $answer are XML::LibXML trees!
    # see XML::Compile::SOAP::Client::compileClient() for wrapper which
    # converts from and to Perl data structures.
    
    my ($answer, $trace) = $call->($request);
    my $answer = $call->($request); # drop $trace info immediately

$obj->headerAddVersions(HEADER)

XML::Compile::Transport::SOAPHTTP->headerAddVersions(HEADER)

    Adds some lines about module versions, which may help debugging or error reports. This is called when a new client or server is being created.

DETAILS

SEE ALSO

This module is part of XML-Compile-SOAP distribution version 0.65, built on January 07, 2008. Website: http://perl.overmeer.net/xml-compile/

LICENSE

Copyrights 2007-2008 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html