PHP SOAPClient error: Root element is missing

时间:2015-09-01 22:52:43

标签: php soap-client

I have the following code:

$client = new SoapClient("http://example.com/service.asmx?WSDL");

$xml = new SimpleXMLElement("<Request></Request>");
$xml->addChild('Credential')->addChild('UID', '123456');

var_dump($client->getUsers($xml));

But the response is always: error: Root element is missing

Also if I try sending the XML result using:

var_dump($client->getUsers($xml->asXML()));

This is the xml returned by the function ->asXML()

<?xml version="1.0"?>
<Request><Credential><UID>123456</UID></Credential></Request>

I get the folowing error (even if I don't send anything):

Value cannot be null. Parameter name: s

Any clue on what is happening with the request?

Thanks in advance.

0 个答案:

没有答案