我对PHP的内置SOAP客户端感到非常沮丧。我在互联网上看到的每一篇文章似乎都表明我尝试过的每一个代码都应该有用,但是没有一个能做到。这是我的代码的简化版本的当前状态,但是其他人已经很多了。
$soapClient = new SoapClient("uReachWebServices.wsdl", array(
"trace" => true,
"soap_version" => SOAP_1_2,
));
$auth = array(
"PartnerId" => "hidden_from_StackOverflow",
"Password" => "hidden_from_StackOverflow",
);
$parameters = array(
phoneNumber => array("PIN" => "XXXX", "_" = "XXXXXXXXXXX"),
);
$header = new SoapHeader("http://schemas.xmlsoap.org/soap/envelope", "Authentication", (object) $auth, false);
$soapClient->__setSoapHeaders($header);
try {
$soapClient->GetMailboxInfo((object) $parameters);
} catch (SoapFault $ex) {
ChromePhp::error($ex->getMessage());
ChromePhp::log($ex->getTraceAsString());
}
ChromePhp::log($soapClient->__getLastRequest());
ChromePhp::log($soapClient->__getLastResponse());
我正在尝试获取参数的以下输出...
<phoneNumber ns1:PIN="XXXX">XXXXXXXXXX</phoneNumber>
...但我尝试的所有内容都会像下列之一一样......
<phoneNumber />
...或...
<key>phoneNumber</key>
<value>xxxxxxxxxx</value>
...或...
<phoneNumber ns1:PIN="XXXX" />
......或者我个人最喜欢的......
<param1><phoneNumber ns1:PIN="XXXX">XXXXXXXXXX</phoneNumber></param1>