我正在尝试将对象传递给soap方法,它期望对象具有3个参数:这是输出:
<SOAP-ENV:Body><ns1:Send xsi:type="foo"><dddd>22222</dddd><oooo>1</oooo><tttt>testi</tttt></ns1:EnviarSMS></SOAP-ENV:Body></SOAP-ENV:Envelope>
$client = new SoapClient($wsdl, array("trace" => 1, "exception" => 0));
$headers = $client->__setSoapHeaders(Array(new WsseAuthHeader($username, $password)));
$params = array("dddd" => "22222", "oooo" => 1, "tttt" => "testi");
function array_to_object($array) {
return (object) $array;
}
$obj = array_to_object($params);
$foosoap = new \SoapVar($obj, SOAP_ENC_OBJECT, 'foo');
try{
$request = $client->send($foosoap);
}catch (\Exception $e){
throw new \Exception("Request Failed! Response:\n".$client->__getLastResponse());
}
我发现发送的参数不正确