1XMLRPC::Transport::HTTPU(s3e)r Contributed Perl DocumentaXtMiLoRnPC::Transport::HTTP(3)
2
3
4
6 XMLRPC::Transport::HTTP - Server/Client side HTTP support for XML‐
7 RPC::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
45 You can use any proxy setting you use with LWP::UserAgent modules:
46
47 XMLRPC::Lite->proxy('http://endpoint.server/',
48 proxy => ['http' => 'http://my.proxy.server']);
49
50 or
51
52 $xmlrpc->transport->proxy('http' => 'http://my.proxy.server');
53
54 should specify proxy server for you. And if you use "HTTP_proxy_user"
55 and "HTTP_proxy_pass" for proxy authorization SOAP::Lite should know
56 how to handle it properly.
57
58 COOKIE-BASED AUTHENTICATION
59
60 use HTTP::Cookies;
61
62 my $cookies = HTTP::Cookies->new(ignore_discard => 1);
63 # you may also add 'file' if you want to keep them between sessions
64
65 my $xmlrpc = XMLRPC::Lite->proxy('http://localhost/');
66 $xmlrpc->transport->cookie_jar($cookies);
67
68 Cookies will be taken from response and provided for request. You may
69 always add another cookie (or extract what you need after response)
70 with HTTP::Cookies interface.
71
72 You may also do it in one line:
73
74 $xmlrpc->proxy('http://localhost/',
75 cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
76
77 COMPRESSION
78
79 XMLRPC::Lite provides you option for enabling compression on wire (for
80 HTTP transport only). Both server and client should support this capa‐
81 bility, but this logic should be absolutely transparent for your appli‐
82 cation. Server will respond with encoded message only if client can
83 accept it (client sends Accept-Encoding with 'deflate' or '*' values)
84 and client has fallback logic, so if server doesn't understand speci‐
85 fied encoding (Content-Encoding: deflate) and returns proper error code
86 (415 NOT ACCEPTABLE) client will repeat the same request not encoded
87 and will store this server in per-session cache, so all other requests
88 will go there without encoding.
89
90 Having options on client and server side that let you specify threshold
91 for compression you can safely enable this feature on both client and
92 server side.
93
94 Compression will be enabled on client side IF: threshold is specified
95 AND size of current message is bigger than threshold AND module Com‐
96 press::Zlib is available. Client will send header 'Accept-Encoding'
97 with value 'deflate' if threshold is specified AND module Com‐
98 press::Zlib is available.
99
100 Server will accept compressed message if module Compress::Zlib is
101 available, and will respond with compressed message ONLY IF: threshold
102 is specified AND size of current message is bigger than threshold AND
103 module Compress::Zlib is available AND header 'Accept-Encoding' is pre‐
104 sented in request.
105
107 Crypt::SSLeay for HTTPS/SSL
108 HTTP::Daemon for XMLRPC::Transport::HTTP::Daemon
109 Apache, Apache::Constants for XMLRPC::Transport::HTTP::Apache
110
112 See ::CGI, ::Daemon and ::Apache for implementation details.
113 See examples/XMLRPC/* for examples.
114
116 Copyright (C) 2000-2001 Paul Kulchenko. All rights reserved.
117
118 This library is free software; you can redistribute it and/or modify it
119 under the same terms as Perl itself.
120
122 Paul Kulchenko (paulclinger@yahoo.com)
123
124
125
126perl v5.8.8 2006-06-15 XMLRPC::Transport::HTTP(3)