source: branches/version-2_11-dev/data/module/SOAP/Transport.php @ 21410

Revision 21410, 3.7 KB checked in by Seasoft, 12 years ago (diff)

2.12系へマイルストーン変更となったチケット分を差し戻し
r21326 #1536
r21325 #1528
r21324 #1547,#1546
r21323 #1546
r21322 #1543
r21321 #1536
r21320 #1536
r21319 #1544
r21318 #1521,#1522
r21317 #1431

  • Property svn:eol-style set to LF
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/**
3 * This file contains the code for an abstract transport layer.
4 *
5 * PHP versions 4 and 5
6 *
7 * LICENSE: This source file is subject to version 2.02 of the PHP license,
8 * that is bundled with this package in the file LICENSE, and is available at
9 * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
10 * did not receive a copy of the PHP license and are unable to obtain it
11 * through the world-wide-web, please send a note to license@php.net so we can
12 * mail you a copy immediately.
13 *
14 * @category   Web Services
15 * @package    SOAP
16 * @author     Dietrich Ayala <dietrich@ganx4.com>
17 * @author     Shane Caraveo <Shane@Caraveo.com>
18 * @author     Jan Schneider <jan@horde.org>
19 * @copyright  2003-2006 The PHP Group
20 * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
21 * @link       http://pear.php.net/package/SOAP
22 */
23
24require_once 'SOAP/Base.php';
25
26/**
27 * SOAP Transport Layer
28 *
29 * This layer can use different protocols dependant on the endpoint url
30 * provided.
31 *
32 * No knowlege of the SOAP protocol is available at this level.
33 * No knowlege of the transport protocols is available at this level.
34 *
35 * @access   public
36 * @package  SOAP
37 * @author   Shane Caraveo <shane@php.net>
38 * @author   Jan Schneider <jan@horde.org>
39 */
40class SOAP_Transport extends SOAP_Base
41{
42    /**
43     * Connection endpoint URL.
44     *
45     * @var string
46     */
47    var $url = '';
48
49    /**
50     * Array containing urlparts.
51     *
52     * @see parse_url()
53     *
54     * @var mixed
55     */
56    var $urlparts = null;
57
58    /**
59     * Incoming payload.
60     *
61     * @var string
62     */
63    var $incoming_payload = '';
64
65    /**
66     * Outgoing payload.
67     *
68     * @var string
69     */
70    var $outgoing_payload = '';
71
72    /**
73     * Request encoding.
74     *
75     * @var string
76     */
77    var $encoding = SOAP_DEFAULT_ENCODING;
78
79    /**
80     * Response encoding.
81     *
82     * We assume UTF-8 if no encoding is set.
83     *
84     * @var string
85     */
86    var $result_encoding = 'UTF-8';
87
88    /**
89     * Decoded attachments from the reponse.
90     *
91     * @var array
92     */
93    var $attachments;
94
95    /**
96     * Request User-Agent.
97     *
98     * @var string
99     */
100    var $_userAgent = SOAP_LIBRARY_NAME;
101
102    /**
103     * Sends and receives SOAP data.
104     *
105     * @access public
106     * @abstract
107     *
108     * @param string  Outgoing SOAP data.
109     * @param array   Options.
110     *
111     * @return string|SOAP_Fault
112     */
113    function send($msg, $options = null)
114    {
115        return $this->_raiseSoapFault('SOAP_Transport::send() not implemented.');
116    }
117
118    function &getTransport($url, $encoding = SOAP_DEFAULT_ENCODING)
119    {
120        $urlparts = @parse_url($url);
121
122        if (!$urlparts['scheme']) {
123            $fault = SOAP_Base_Object::_raiseSoapFault("Invalid transport URI: $url");
124            return $fault;
125        }
126
127        if (strcasecmp($urlparts['scheme'], 'mailto') == 0) {
128            $transport_type = 'SMTP';
129        } elseif (strcasecmp($urlparts['scheme'], 'https') == 0) {
130            $transport_type = 'HTTP';
131        } else {
132            /* Handle other transport types */
133            $transport_type = strtoupper($urlparts['scheme']);
134        }
135        $transport_include = 'SOAP/Transport/' . basename($transport_type) . '.php';
136        $res = @include_once($transport_include);
137        if (!$res) {
138            $fault = SOAP_Base_Object::_raiseSoapFault("No Transport for {$urlparts['scheme']}");
139            return $fault;
140        }
141        $transport_class = "SOAP_Transport_$transport_type";
142        if (!class_exists($transport_class)) {
143            $fault = SOAP_Base_Object::_raiseSoapFault("No Transport class $transport_class");
144            return $fault;
145        }
146        $t =& new $transport_class($url, $encoding);
147
148        return $t;
149    }
150
151}
Note: See TracBrowser for help on using the repository browser.