PHP SOAP空响应

PHP SOAP空响应,php,soap,Php,Soap,我正在尝试使用soapui访问soap接口。一切正常: 请求: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soc="www.example.com"> <soapenv:Header/> <soapenv:Body> <soc:getMailboxes> <userId>51

我正在尝试使用soapui访问soap接口。一切正常:

请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soc="www.example.com">
   <soapenv:Header/>
   <soapenv:Body>
      <soc:getMailboxes>
         <userId>512</userId>
      </soc:getMailboxes>
   </soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <getMailboxesResponse xmlns="http://www.example.com">
         <getMailboxesReturn>
            <mailboxes>
               <mailboxes>
                  <administratorNumbers/>
                  <administratorUsers>
                     <administratorUsers>512</administratorUsers>
                  </administratorUsers>
                  <allowsSuppressedNumbers>true</allowsSuppressedNumbers>
                  <deactivatedByAdmin>false</deactivatedByAdmin>
                  <deactivatedByUser>false</deactivatedByUser>
                  <mailNotificationActive>true</mailNotificationActive>
                  <name>speech box</name>
                  <notificationNumber xsi:nil="true"/>
                  <number>123123123</number>
                  <pin xsi:nil="true"/>
                  <recordConferenceCallActive>false</recordConferenceCallActive>
                  <sendSmsCount>0</sendSmsCount>
                  <sendSmsLimit>0</sendSmsLimit>
                  <smsNotificationActive>false</smsNotificationActive>
                  <tag xsi:nil="true"/>
                  <type>CLASSIC</type>
                  <voicemailEnabled>false</voicemailEnabled>
                  <whitelistedNumbers/>
               </mailboxes>
            </mailboxes>
            <responseCode>
               <ID>0</ID>
               <name>OK</name>
            </responseCode>
         </getMailboxesReturn>
      </getMailboxesResponse>
   </soapenv:Body>
</soapenv:Envelope>
我得到了这个结果:

array(2) {
  ["mailboxes"]=>
  object(stdClass)#4 (0) {
  }
  ["responseCode"]=>
  object(stdClass)#5 (2) {
    ["ID"]=>
    int(0)
    ["name"]=>
    string(2) "OK"
  }
}
我假设一个响应有一些值,比如soapui响应(比如object(stdClass)#5)?如果我发送了错误的用户ID,我会得到正确的错误消息。有人能帮我吗

更新1: getMailboxes方法创建以下代码:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com">
    <SOAP-ENV:Body>
        <ns1:getMailboxes>
            <userId>512</userId>
        </ns1:getMailboxes>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
$response = $client->getMailboxes(["userId"=>512]);
我得到了这个soap代码。用户ID应该是512,而不是1

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="www.example.com">
<SOAP-ENV:Body>
    <ns1:getMailboxes>
        <userId>1</userId>
    </ns1:getMailboxes>
</SOAP-ENV:Body></SOAP-ENV:Envelope>

此呼叫不正确:

$response = $client->getMailboxes(512);
请注意,在原始XML中,您正在告诉它512的含义是什么?PHP也是如此,您必须使用关联数组来标识发送的参数:

$response = $client->getMailboxes(["userId"=>"512"]);

此呼叫不正确:

$response = $client->getMailboxes(512);
请注意,在原始XML中,您正在告诉它512的含义是什么?PHP也是如此,您必须使用关联数组来标识发送的参数:

$response = $client->getMailboxes(["userId"=>"512"]);

你能提供
getMailboxes
方法内容吗?你是什么意思?我使用SoapClient类。getMailboxes源于wsdl(至少我认为是这样)。您能提供
getMailboxes
方法内容吗?您的意思是什么?我使用SoapClient类。getMailboxes是从wsdl派生的(至少我这么认为)。感谢您的回复。我尝试了你的代码,但得到了错误的结果:$response=$client->getMailboxes([“userId”=>512]);创建值为1的用户标识。1(我收到了带有$client->\uuu getLastRequest()的soap代码)结果中没有更改感谢您的回复。我尝试了你的代码,但得到了错误的结果:$response=$client->getMailboxes([“userId”=>512]);创建值为1的用户标识。1(我收到了带有$client->\uuu getLastRequest()的soap代码)结果没有变化