I am having issue while crafting SOAP request using PHP's SOAP Client library.
So here is my code:
$xmlr = new \SimpleXMLElement("<CustomerSearch></CustomerSearch>");
$xmlr->addChild('AuthorID', 'aaa');
$xmlr->addChild('UserID', 2)->addAttribute('type', 'lol');
$xmlr->addChild('UserPassword', 'dffds');
$xmlr->addChild('Email', 'fdfd');
$this->soapClient->__soapCall("OTA_HotelResNotifRQ", [ 'type' => 'lol', new \SoapVar($xmlr->asXML(), \XSD_ANYXML)] );
This code produces XML that looks like this:
<SOAP-ENV:Body>
<ns1:OTA_HotelResNotifRQ>
<param0 xsi:type="xsd:string">lol</param0>
<CustomerSearch>
<AuthorID>aaa</AuthorID>
<UserID type="lol">2</UserID>
<UserPassword>dffds</UserPassword>
<Email>fdfd</Email>
</CustomerSearch>
</ns1:OTA_HotelResNotifRQ>
</SOAP-ENV:Body>
This is not what I am trying to achieve. Using SimpleXMLElement I can achieve level of flexibility that I need. However, request method nodes are crafted using SoapClient itself. This is the part in which I have most problems, since I don't know how to customize it. Node would also need attributes, and I simply don't know how to add it. Final request should look like this:
<SOAP-ENV:Body>
<ns1:OTA_HotelResNotifRQ type="lol">
<CustomerSearch>
<AuthorID>aaa</AuthorID>
<UserID type="lol">2</UserID>
<UserPassword>dffds</UserPassword>
<Email>fdfd</Email>
</CustomerSearch>
</ns1:OTA_HotelResNotifRQ>
</SOAP-ENV:Body>
Does anyone knows how to do it correctly? Thanks