1XMLRPC::Transport::HTTPU(s3e)r Contributed Perl DocumentaXtMiLoRnPC::Transport::HTTP(3)
2
3
4
6 XMLRPC::Transport::HTTP - Server/Client side HTTP support for
7 XMLRPC::Lite
8
10 Client
11 use XMLRPC::Lite
12 proxy => 'http://localhost/',
13 # proxy => 'http://localhost/cgi-bin/xmlrpc.cgi', # local CGI server
14 # proxy => 'http://localhost/', # local daemon server
15 # proxy => 'http://login:password@localhost/cgi-bin/xmlrpc.cgi', # local CGI server with authentication
16 ;
17
18 print getStateName(1);
19
20 CGI server
21 use XMLRPC::Transport::HTTP;
22
23 my $server = XMLRPC::Transport::HTTP::CGI
24 -> dispatch_to('methodName')
25 -> handle
26 ;
27
28 Daemon server
29 use XMLRPC::Transport::HTTP;
30
31 my $daemon = XMLRPC::Transport::HTTP::Daemon
32 -> new (LocalPort => 80)
33 -> dispatch_to('methodName')
34 ;
35 print "Contact to XMLRPC server at ", $daemon->url, "\n";
36 $daemon->handle;
37
39 This class encapsulates all HTTP related logic for a XMLRPC server,
40 independent of what web server it's attached to. If you want to use
41 this class you should follow simple guideline mentioned above.
42
43 PROXY SETTINGS
44 You can use any proxy setting you use with LWP::UserAgent modules:
45
46 XMLRPC::Lite->proxy('http://endpoint.server/',
47 proxy => ['http' => 'http://my.proxy.server']);
48
49 or
50
51 $xmlrpc->transport->proxy('http' => 'http://my.proxy.server');
52
53 should specify proxy server for you. And if you use "HTTP_proxy_user"
54 and "HTTP_proxy_pass" for proxy authorization SOAP::Lite should know
55 how to handle it properly.
56
57 COOKIE-BASED AUTHENTICATION
58 use HTTP::Cookies;
59
60 my $cookies = HTTP::Cookies->new(ignore_discard => 1);
61 # you may also add 'file' if you want to keep them between sessions
62
63 my $xmlrpc = XMLRPC::Lite->proxy('http://localhost/');
64 $xmlrpc->transport->cookie_jar($cookies);
65
66 Cookies will be taken from response and provided for request. You may
67 always add another cookie (or extract what you need after response)
68 with HTTP::Cookies interface.
69
70 You may also do it in one line:
71
72 $xmlrpc->proxy('http://localhost/',
73 cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
74
75 COMPRESSION
76 XMLRPC::Lite provides you option for enabling compression on wire (for
77 HTTP transport only). Both server and client should support this
78 capability, but this logic should be absolutely transparent for your
79 application. Server will respond with encoded message only if client
80 can accept it (client sends Accept-Encoding with 'deflate' or '*'
81 values) and client has fallback logic, so if server doesn't understand
82 specified encoding (Content-Encoding: deflate) and returns proper error
83 code (415 NOT ACCEPTABLE) client will repeat the same request not
84 encoded and will store this server in per-session cache, so all other
85 requests will go there without encoding.
86
87 Having options on client and server side that let you specify threshold
88 for compression you can safely enable this feature on both client and
89 server side.
90
91 Compression will be enabled on client side IF: threshold is specified
92 AND size of current message is bigger than threshold AND module
93 Compress::Zlib is available. Client will send header 'Accept-Encoding'
94 with value 'deflate' if threshold is specified AND module
95 Compress::Zlib is available.
96
97 Server will accept compressed message if module Compress::Zlib is
98 available, and will respond with compressed message ONLY IF: threshold
99 is specified AND size of current message is bigger than threshold AND
100 module Compress::Zlib is available AND header 'Accept-Encoding' is
101 presented in request.
102
104 Crypt::SSLeay for HTTPS/SSL
105 HTTP::Daemon for XMLRPC::Transport::HTTP::Daemon
106 Apache, Apache::Constants for XMLRPC::Transport::HTTP::Apache
107
109 See ::CGI, ::Daemon and ::Apache for implementation details.
110 See examples/XMLRPC/* for examples.
111
113 Copyright (C) 2000-2001 Paul Kulchenko. All rights reserved.
114
115 This library is free software; you can redistribute it and/or modify it
116 under the same terms as Perl itself.
117
119 Paul Kulchenko (paulclinger@yahoo.com)
120
121
122
123perl v5.38.0 2023-07-21 XMLRPC::Transport::HTTP(3)