Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezsoaprequest.php
Go to the documentation of this file.
1 <?php
18 class eZSOAPRequest extends eZSOAPEnvelope
19 {
26 public function __construct( $name="", $namespace="", $parameters = array() )
27 {
28 $this->Name = $name;
29 $this->Namespace = $namespace;
30
31 parent::__construct();
32
33 foreach( $parameters as $name => $value )
34 {
35 $this->addParameter( $name, $value );
36 }
37 }
38
42 function name()
43 {
44 return $this->Name;
45 }
46
52 function ns()
53 {
54 return $this->Namespace;
55 }
56
64 function addBodyAttribute( $name, $value, $prefix = false )
65 {
66 $this->BodyAttributes[( $prefix ? $prefix . ':' : '' ) . $name] = $value;
67 }
68
73 function addParameter( $name, $value )
74 {
75 $this->Parameters[] = new eZSOAPParameter( $name, $value );
76 }
77
81 function payload()
82 {
83 $doc = new DOMDocument( "1.0" );
84 $doc->name = 'eZSOAP message';
85
86 $root = $doc->createElementNS( eZSOAPEnvelope::ENV, eZSOAPEnvelope::ENV_PREFIX . ':Envelope' );
87
88 $root->setAttribute( 'xmlns:' . eZSOAPEnvelope::XSI_PREFIX, eZSOAPEnvelope::SCHEMA_INSTANCE );
89 $root->setAttribute( 'xmlns:' . eZSOAPEnvelope::XSD_PREFIX, eZSOAPEnvelope::SCHEMA_DATA );
90 $root->setAttribute( 'xmlns:' . eZSOAPEnvelope::ENC_PREFIX, eZSOAPEnvelope::ENC );
91
92 // add the body
93 $body = $doc->createElement( eZSOAPEnvelope::ENV_PREFIX . ':Body' );
94 $body->setAttribute( 'xmlns:req', $this->Namespace );
95
96 foreach( $this->BodyAttributes as $name => $value )
97 {
98 $body->setAttribute( $name, $value );
99 }
100
101 $root->appendChild( $body );
102
103 // add the request
104 $request = $doc->createElement( 'req:' . $this->Name );
105
106 // add the request parameters
107 foreach ( $this->Parameters as $parameter )
108 {
109 $param = eZSOAPCodec::encodeValue( $doc, $parameter->name(), $parameter->value() );
110
111 if ( $param == false )
112 {
113 eZDebug::writeError( "Error encoding data for payload: " . $parameter->name(), __METHOD__ );
114 continue;
115 }
116 $request->appendChild( $param );
117 }
118
119 $body->appendChild( $request );
120
121 $doc->appendChild( $root );
122 return $doc->saveXML();
123 }
124
126 public $Name;
127
129 public $Namespace;
130
132 public $BodyAttributes = array();
133
135 public $Parameters = array();
136 }
137
138 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZSOAPCodec\encodeValue
static encodeValue( $doc, $name, $value)
Definition: ezsoapcodec.php:23
eZSOAPEnvelope
SOAP envelope handling and definition.
Definition: ezsoapenvelope.php:21
eZSOAPEnvelope\XSI_PREFIX
const XSI_PREFIX
Definition: ezsoapenvelope.php:29
eZSOAPEnvelope\ENC_PREFIX
const ENC_PREFIX
Definition: ezsoapenvelope.php:28
eZSOAPEnvelope\ENV_PREFIX
const ENV_PREFIX
Definition: ezsoapenvelope.php:27
eZSOAPEnvelope\XSD_PREFIX
const XSD_PREFIX
Definition: ezsoapenvelope.php:30
eZSOAPEnvelope\SCHEMA_DATA
const SCHEMA_DATA
Definition: ezsoapenvelope.php:25
eZSOAPEnvelope\ENC
const ENC
Definition: ezsoapenvelope.php:23
eZSOAPEnvelope\ENV
const ENV
Definition: ezsoapenvelope.php:22
eZSOAPEnvelope\SCHEMA_INSTANCE
const SCHEMA_INSTANCE
Definition: ezsoapenvelope.php:24
eZSOAPParameter
eZSOAPParameter handles parameters to SOAP requests
Definition: ezsoapparameter.php:20
eZSOAPRequest
eZSOAPRequest handles SOAP request messages
Definition: ezsoaprequest.php:19
eZSOAPRequest\$Namespace
$Namespace
The request target namespace.
Definition: ezsoaprequest.php:129
eZSOAPRequest\$BodyAttributes
$BodyAttributes
Additional body element attributes.
Definition: ezsoaprequest.php:132
eZSOAPRequest\addParameter
addParameter( $name, $value)
Definition: ezsoaprequest.php:73
eZSOAPRequest\$Parameters
$Parameters
Contains the request parameters.
Definition: ezsoaprequest.php:135
eZSOAPRequest\ns
ns()
Definition: ezsoaprequest.php:52
eZSOAPRequest\name
name()
Definition: ezsoaprequest.php:42
eZSOAPRequest\$Name
$Name
The request name.
Definition: ezsoaprequest.php:126
eZSOAPRequest\addBodyAttribute
addBodyAttribute( $name, $value, $prefix=false)
Definition: ezsoaprequest.php:64
eZSOAPRequest\__construct
__construct( $name="", $namespace="", $parameters=array())
Definition: ezsoaprequest.php:26
eZSOAPRequest\payload
payload()
Definition: ezsoaprequest.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.