- Модуль: webservice
- Путь к файлу: ~/bitrix/modules/webservice/classes/general/soap/soaprequest.php
- Класс: varCSOAPRequest
- Вызов: CSOAPRequest::payload
function payload()
{
$root = new CXMLCreator( "soap:Envelope" );
$root->setAttribute("xmlns:soap", BX_SOAP_ENV);
$root->setAttribute( BX_SOAP_XSI_PREFIX, BX_SOAP_SCHEMA_INSTANCE );
$root->setAttribute( BX_SOAP_XSD_PREFIX, BX_SOAP_SCHEMA_DATA );
$root->setAttribute( BX_SOAP_ENC_PREFIX, BX_SOAP_ENC );
$header = new CXMLCreator( "soap:Header" );
$root->addChild( $header );
foreach ($this->Headers as $hx)
$header->addChild($hx);
// add the body
$body = new CXMLCreator( "soap:Body" );
foreach( $this->BodyAttributes as $attribute => $value)
{
$body->setAttribute( $attribute, $value );
}
// add the request
$request = new CXMLCreator( $this->Name );
$request->setAttribute("xmlns", $this->Namespace);
// add the request parameters
$param = null;
foreach ( $this->Parameters as $parameter => $value )
{
unset( $param );
$param = CXMLCreator::encodeValueLight( $parameter, $value );
if ( $param == false )
ShowError( "Error enconding data for payload" );
$request->addChild( $param );
}
$body->addChild( $request );
$root->addChild( $body );
return CXMLCreator::getXMLHeader().$root->getXML();
}