26 Feb 2004 16:36:26 UTC
- Distribution: SOAP-Lite
- Module version: 0.60
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (67)
- Testers (7 / 0 / 0)
- KwaliteeBus factor: 0
- License: unknown
- Download (166.4KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:9 non-PAUSE users
- SEE ALSO
XMLRPC::Transport::HTTP - Server/Client side HTTP support for XMLRPC::Lite
use XMLRPC::Lite proxy => 'http://localhost/', # proxy => 'http://localhost/cgi-bin/xmlrpc.cgi', # local CGI server # proxy => 'http://localhost/', # local daemon server # proxy => 'http://login:password@localhost/cgi-bin/xmlrpc.cgi', # local CGI server with authentication ; print getStateName(1);
- CGI server
use XMLRPC::Transport::HTTP; my $server = XMLRPC::Transport::HTTP::CGI -> dispatch_to('methodName') -> handle ;
- Daemon server
use XMLRPC::Transport::HTTP; my $daemon = XMLRPC::Transport::HTTP::Daemon -> new (LocalPort => 80) -> dispatch_to('methodName') ; print "Contact to XMLRPC server at ", $daemon->url, "\n"; $daemon->handle;
This class encapsulates all HTTP related logic for a XMLRPC server, independent of what web server it's attached to. If you want to use this class you should follow simple guideline mentioned above.
You can use any proxy setting you use with LWP::UserAgent modules:
XMLRPC::Lite->proxy('http://endpoint.server/', proxy => ['http' => 'http://my.proxy.server']);
$xmlrpc->transport->proxy('http' => 'http://my.proxy.server');
should specify proxy server for you. And if you use
HTTP_proxy_passfor proxy authorization SOAP::Lite should know how to handle it properly.
use HTTP::Cookies; my $cookies = HTTP::Cookies->new(ignore_discard => 1); # you may also add 'file' if you want to keep them between sessions my $xmlrpc = XMLRPC::Lite->proxy('http://localhost/'); $xmlrpc->transport->cookie_jar($cookies);
Cookies will be taken from response and provided for request. You may always add another cookie (or extract what you need after response) with HTTP::Cookies interface.
You may also do it in one line:
$xmlrpc->proxy('http://localhost/', cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
XMLRPC::Lite provides you option for enabling compression on wire (for HTTP transport only). Both server and client should support this capability, but this logic should be absolutely transparent for your application. Server will respond with encoded message only if client can accept it (client sends Accept-Encoding with 'deflate' or '*' values) and client has fallback logic, so if server doesn't understand specified encoding (Content-Encoding: deflate) and returns proper error code (415 NOT ACCEPTABLE) client will repeat the same request not encoded and will store this server in per-session cache, so all other requests will go there without encoding.
Having options on client and server side that let you specify threshold for compression you can safely enable this feature on both client and server side.
Compression will be enabled on client side IF: threshold is specified AND size of current message is bigger than threshold AND module Compress::Zlib is available. Client will send header 'Accept-Encoding' with value 'deflate' if threshold is specified AND module Compress::Zlib is available.
Server will accept compressed message if module Compress::Zlib is available, and will respond with compressed message ONLY IF: threshold is specified AND size of current message is bigger than threshold AND module Compress::Zlib is available AND header 'Accept-Encoding' is presented in request.
Crypt::SSLeay for HTTPS/SSL HTTP::Daemon for XMLRPC::Transport::HTTP::Daemon Apache, Apache::Constants for XMLRPC::Transport::HTTP::Apache
See ::CGI, ::Daemon and ::Apache for implementation details. See examples/XMLRPC/* for examples.
Copyright (C) 2000-2001 Paul Kulchenko. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Paul Kulchenko (email@example.com)
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|