Inheritance diagram for ilBMFTransport_TCP:
Collaboration diagram for ilBMFTransport_TCP:Public Member Functions | |
| ilBMFTransport_TCP ($URL, $encoding=SOAP_DEFAULT_ENCODING) | |
| ilBMFTransport_TCP Constructor | |
| _socket_ping () | |
| & | send (&$msg, $options=NULL) |
| send and receive soap data | |
| _validateUrl () | |
| validate url data passed to constructor | |
Data Fields | |
| $headers = array() | |
| $urlparts = NULL | |
| $url = '' | |
| $incoming_payload = '' | |
| $_userAgent = SOAP_LIBRARY_NAME | |
| $encoding = SOAP_DEFAULT_ENCODING | |
| $result_encoding = 'UTF-8' | |
| $result_content_type | |
| $socket = '' | |
Definition at line 37 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::_socket_ping | ( | ) |
Definition at line 67 of file class.ilBMFTransport_TCP.php.
References $result.
Referenced by send().
{
// XXX how do we restart after socket_shutdown?
//if (!$this->socket) {
# create socket resource
$this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($this->socket < 0) return 0;
# connect
$result = socket_connect($this->socket, $this->urlparts['host'], $this->urlparts['port']);
if ($result < 0) return 0;
//}
return 1;
}
Here is the caller graph for this function:| ilBMFTransport_TCP::_validateUrl | ( | ) |
validate url data passed to constructor
Definition at line 133 of file class.ilBMFTransport_TCP.php.
References ilBMFBase_Object::_raiseSoapFault().
Referenced by send().
{
if ( ! is_array($this->urlparts) ) {
$this->_raiseSoapFault("Unable to parse URL $url");
return FALSE;
}
if (!isset($this->urlparts['host'])) {
$this->_raiseSoapFault("No host in URL $url");
return FALSE;
}
if (!isset($this->urlparts['path']) || !$this->urlparts['path'])
$this->urlparts['path'] = '/';
return TRUE;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilBMFTransport_TCP::ilBMFTransport_TCP | ( | $ | URL, | |
| $ | encoding = SOAP_DEFAULT_ENCODING | |||
| ) |
ilBMFTransport_TCP Constructor
| string | $URL http url to soap endpoint |
public
Definition at line 59 of file class.ilBMFTransport_TCP.php.
References $encoding, and ilBMFBase_Object::ilBMFBase_Object().
{
parent::ilBMFBase_Object('TCP');
$this->urlparts = @parse_url($URL);
$this->url = $URL;
$this->encoding = $encoding;
}
Here is the call graph for this function:| & ilBMFTransport_TCP::send | ( | &$ | msg, | |
| $ | options = NULL | |||
| ) |
send and receive soap data
| string | &$msg outgoing post data | |
| string | $action SOAP Action header data |
Definition at line 90 of file class.ilBMFTransport_TCP.php.
References ilBMFBase_Object::_raiseSoapFault(), _socket_ping(), and _validateUrl().
{
$this->incoming_payload = '';
$this->outgoing_payload = &$msg;
if (!$this->_validateUrl()) return $this->fault;
# check for TCP scheme
if (strcasecmp($this->urlparts['scheme'], 'TCP') == 0) {
# check connection
if (!$this->_socket_ping())
return $this->_raiseSoapFault('error on '.$this->url.' reason '.socket_strerror(socket_last_error($this->socket)));
# write to the socket
if (!@socket_write($this->socket, $this->outgoing_payload, strlen($this->outgoing_payload))) {
return $this->_raiseSoapFault('Error sending data to '.$this->url.' reason '.socket_strerror(socket_last_error($this->socket)));
}
# shutdown writing
if(!socket_shutdown($this->socket, 1))
return $this->_raiseSoapFault("can't change socket mode to read.");
# read everything we can.
while($buf = @socket_read($this->socket, 1024, PHP_BINARY_READ)) {
$this->incoming_payload .= $buf;
}
# return payload or die
if ($this->incoming_payload)
return $this->incoming_payload;
return $this->_raiseSoapFault("Error reveiving data from ".$this->url);
}
return $this->_raiseSoapFault('Invalid url scheme '.$this->url);
}
Here is the call graph for this function:| ilBMFTransport_TCP::$_userAgent = SOAP_LIBRARY_NAME |
Definition at line 44 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$encoding = SOAP_DEFAULT_ENCODING |
Definition at line 45 of file class.ilBMFTransport_TCP.php.
Referenced by ilBMFTransport_TCP().
| ilBMFTransport_TCP::$headers = array() |
Definition at line 40 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$incoming_payload = '' |
Definition at line 43 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$result_content_type |
Definition at line 47 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$result_encoding = 'UTF-8' |
Definition at line 46 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$socket = '' |
Definition at line 50 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$url = '' |
Definition at line 42 of file class.ilBMFTransport_TCP.php.
| ilBMFTransport_TCP::$urlparts = NULL |
Definition at line 41 of file class.ilBMFTransport_TCP.php.
1.7.1