1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
soaprequest.php
См. документацию.
1<?php
2
4{
6 var $Name;
7
10
12 var $Headers = array();
13
16
19
20 public function __construct( $name="", $namespace="", $parameters = array() )
21 {
22 $this->Name = $name;
23 $this->Namespace = $namespace;
24
25 // call the parents constructor
26 parent::__construct();
27
28 foreach( $parameters as $name => $value )
29 {
30 $this->addParameter( $name, $value );
31 }
32 }
33
34 function name()
35 {
36 return $this->Name;
37 }
38
39 function get_namespace()
40 {
41 return $this->Namespace;
42 }
43
44 function GetSOAPAction($separator = '/')
45 {
46 if ($this->Namespace[mb_strlen($this->Namespace) - 1] != $separator)
47 {
48 return $this->Namespace . $separator . $this->Name;
49 }
50 return $this->Namespace . $this->Name;
51 }
52
53 function addSOAPHeader( $name, $value )
54 {
55 $this->Headers[] = CXMLCreator::encodeValueLight($name, $value);
56 }
57
58 // Adds a new attribute to the body element.
59 function addBodyAttribute( $name, $value )
60 {
61 $this->BodyAttributes[$name] = $value;
62 }
63
64 // Adds a new parameter to the request. You have to provide a prameter name
65 // and value.
66 function addParameter( $name, $value )
67 {
68 $this->Parameters[$name] = $value;
69 }
70
71 // Returns the request payload
72 function payload()
73 {
74 $root = new CXMLCreator( "soap:Envelope" );
75 $root->setAttribute("xmlns:soap", BX_SOAP_ENV);
76
77 $root->setAttribute( BX_SOAP_XSI_PREFIX, BX_SOAP_SCHEMA_INSTANCE );
78 $root->setAttribute( BX_SOAP_XSD_PREFIX, BX_SOAP_SCHEMA_DATA );
79 $root->setAttribute( BX_SOAP_ENC_PREFIX, BX_SOAP_ENC );
80
81 $header = new CXMLCreator( "soap:Header" );
82 $root->addChild( $header );
83
84 foreach ($this->Headers as $hx)
85 $header->addChild($hx);
86
87 // add the body
88 $body = new CXMLCreator( "soap:Body" );
89
90 foreach( $this->BodyAttributes as $attribute => $value)
91 {
92 $body->setAttribute( $attribute, $value );
93 }
94
95 // add the request
96 $request = new CXMLCreator( $this->Name );
97 $request->setAttribute("xmlns", $this->Namespace);
98
99 // add the request parameters
100 $param = null;
101 foreach ( $this->Parameters as $parameter => $value )
102 {
103 unset( $param );
104 $param = CXMLCreator::encodeValueLight( $parameter, $value );
105
106 if ( $param == false )
107 ShowError( "Error enconding data for payload" );
108 $request->addChild( $param );
109 }
110
111 $body->addChild( $request );
112 $root->addChild( $body );
113 return CXMLCreator::getXMLHeader().$root->getXML();
114 }
115}
116
117?>
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
Определения soapbase.php:40
Определения soaprequest.php:4
GetSOAPAction($separator='/')
Определения soaprequest.php:44
__construct( $name="", $namespace="", $parameters=array())
Определения soaprequest.php:20
payload()
Определения soaprequest.php:72
$Parameters
Contains the request parameters.
Определения soaprequest.php:18
$Namespace
The request target namespace.
Определения soaprequest.php:9
name()
Определения soaprequest.php:34
$BodyAttributes
Additional body element attributes.
Определения soaprequest.php:15
addParameter( $name, $value)
Определения soaprequest.php:66
$Name
The request name.
Определения soaprequest.php:6
get_namespace()
Определения soaprequest.php:39
addBodyAttribute( $name, $value)
Определения soaprequest.php:59
addSOAPHeader( $name, $value)
Определения soaprequest.php:53
$Headers
Headers.
Определения soaprequest.php:12
Определения xmlcreator.php:3
static getXMLHeader()
Определения xmlcreator.php:198
static encodeValueLight( $name, $value)
Определения xmlcreator.php:67
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
ShowError($strError, $cls="errortext")
Определения tools.php:4499
$name
Определения menu_edit.php:35
const BX_SOAP_SCHEMA_DATA
Определения soapbase.php:6
const BX_SOAP_SCHEMA_INSTANCE
Определения soapbase.php:5
const BX_SOAP_ENC_PREFIX
Определения soapbase.php:9
const BX_SOAP_ENV
Определения soapbase.php:3
const BX_SOAP_ENC
Определения soapbase.php:4
const BX_SOAP_XSD_PREFIX
Определения soapbase.php:11
const BX_SOAP_XSI_PREFIX
Определения soapbase.php:10