I\'m trying to call a SOAP method using PHP.
Here\'s the code I\'ve got:
$data = array(\'Acquirer\' =>
array(
\'Id\' => \'MyId\',
\'U
There are a couple of ways to solve this. The least hackiest and almost what you want:
$client = new SoapClient(
null,
array(
'location' => 'https://example.com/ExampleWebServiceDL/services/ExampleHandler',
'uri' => 'http://example.com/wsdl',
'trace' => 1,
'use' => SOAP_LITERAL,
)
);
$params = new \SoapVar("MyId MyUserId MyPassword ", XSD_ANYXML);
$result = $client->Echo($params);
This gets you the following XML:
MyId
MyUserId
MyPassword
That is almost exactly what you want, except for the namespace on the method name. I don't know if this is a problem. If so, you can hack it even further. You could put the tag in the XML string by hand and have the SoapClient not set the method by adding 'style' => SOAP_DOCUMENT, to the options array like this:
$client = new SoapClient(
null,
array(
'location' => 'https://example.com/ExampleWebServiceDL/services/ExampleHandler',
'uri' => 'http://example.com/wsdl',
'trace' => 1,
'use' => SOAP_LITERAL,
'style' => SOAP_DOCUMENT,
)
);
$params = new \SoapVar("MyId MyUserId MyPassword ", XSD_ANYXML);
$result = $client->MethodNameIsIgnored($params);
This results in the following request XML:
MyId
MyUserId
MyPassword
Finally, if you want to play around with SoapVar and SoapParam objects, you can find a good reference in this comment in the PHP manual: http://www.php.net/manual/en/soapvar.soapvar.php#104065. If you get that to work, please let me know, I failed miserably.