Как вставить в поле soap запроса xml-фрагмент?
Помогите пожалуйста убрать экранирование html. Использую Mongosoft\Soap\Client. Отправляю запрос:
$client = new \mongosoft\soapclient\Client([
'url' => 'url',
'options' => [
'trace' => 1,
'exceptions' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
],
]);
$params= [
'Id' => 213212,
'Xml' => $xml,
'Status' => 0,
'Role' => 1,
];
$response = $client->Test(['request' => $params]);
Xml выглядит следующим образом:
<![CDATA[
<Documents>
<Document>
<SupplierInfo>
<Supplier IDNO="1111111111111">
<BankAccount>22222222222222</BankAccount>
</Supplier>
<Buyer IDNO="3333333333333333">
<BankAccount>44444444444444444444444444</BankAccount>
</Buyer>
<Merchandises>
<MerchandiseRows>
<Row Code="1" Name="Name 1" UnitOfMeasure="u" Quantity="1" UnitPrice="1111" TotalTVA="0" TotalPrice="1111" PackageType="" NumberOfPlaces="" GrossWeight="0" TotalCost="1111"/>
</MerchandiseRows>
</Merchandises>
</SupplierInfo>
</Document>
</Documents>
]]>
В логах получаю запрос вида:
<ns2:request>
<ns1:Id>213212</ns1:Id>
<ns1:Role>1</ns1:Role>
<ns1:Xml>
<Documents><![CDATA[<Document>
<SupplierInfo>
<Supplier IDNO="1111111111111">
<BankAccount>22222222222222</BankAccount>
</Supplier>
<Buyer IDNO="3333333333333333">
<BankAccount>44444444444444444444444444</BankAccount>
</Buyer>
<Merchandises>
<MerchandiseRows>
<Row Code="1" Name="Name 1" UnitOfMeasure="u" Quantity="1" UnitPrice="1111" TotalTVA="0" TotalPrice="1111" PackageType="" NumberOfPlaces="" GrossWeight="0" TotalCost="1111"/>
</MerchandiseRows>
</Merchandises>
</SupplierInfo>
</Document>]]></Documents>
</ns1:Xml>
<ns1:Status>0</ns1:Status>
</ns2:request>
Xml фрагмент пробовал добавлять с использованием DOMDocument и SimpleXMLElement, результат тот же.
Если добавлять так:
'Xml' => new \SoapVar($xmlFragment, XSD_ANYXML),
xml-фрагмент вставляется правильно, но без названия поля 'Xml'
<ns2:request>
<ns1:Id>213212</ns1:Id>
<ns1:Role>1</ns1:Role>
<![CDATA[
<Documents>
<Document>
<SupplierInfo>
<Supplier IDNO="1111111111111">
<BankAccount>22222222222222</BankAccount>
</Supplier>
<Buyer IDNO="3333333333333333">
<BankAccount>44444444444444444444444444</BankAccount>
</Buyer>
<Merchandises>
<MerchandiseRows>
<Row Code="1" Name="Name 1" UnitOfMeasure="u" Quantity="1" UnitPrice="1111" TotalTVA="0" TotalPrice="1111" PackageType="" NumberOfPlaces="" GrossWeight="0" TotalCost="1111"/>
</MerchandiseRows>
</Merchandises>
</SupplierInfo>
</Document>
</Documents>
]]>
<ns1:Status>0</ns1:Status>
</ns2:request>