Note that there are some explanatory texts on larger screens.

plurals
  1. POSOAP server doesn't get all the arguments
    primarykey
    data
    text
    <p>I am using PHP and I use SOAP class that is bundled with PHP. I spent all day trying to figure out why this wasn't working. </p> <p>I wrote this on client side:</p> <pre><code> $client = new SoapClient("Audit.wsdl"); $params=array('SerialNumber'=&gt;'PB4LAX6JLJT7M','PercentProgress'=&gt;'50','ResultID'=&gt;'5'); $result=$client-&gt;__soapCall('HardDriveStatusUpdate',array($params)); </code></pre> <p>I then wrote this on server side:</p> <pre><code>function HardDriveStatusUpdate($sn, $p, $rs) { $serialNumber=$sn-&gt;SerialNumber; $percentProgress=$p-&gt;PercentProgress; $resultID=$rs-&gt;ResultID; // process with variables return array('HardDriveStatusUpdateResult' =&gt; '$result'); } $server=new SoapServer('Audit.wsdl'); $server-&gt;addFunction('HardDriveStatusUpdate'); $server-&gt;handle(); </code></pre> <p>I noticed that nothing was happening. To debug, I had the function to write to a file with "$serialNumber, $percentProgress, $resultID". It turns out that it was getting only the first argument, but the second and third argument were empty. (it showed "PB4LAX6JLJT7M,,") Why? </p> <p>WSDL says:</p> <pre><code> &lt;s:element name="HardDriveStatusUpdate"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="SerialNumber" type="s:string" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="PercentProgress" type="s:int" /&gt; &lt;s:element minOccurs="1" maxOccurs="1" name="ResultID" type="s:int" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; </code></pre> <p>Was there something wrong with how I constructed the parameters? </p> <p>Tested with __getLastRequest():</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://127.0.0.1/soap/"&gt; &lt;SOAP-ENV:Body&gt; &lt;ns1:HardDriveStatusUpdate&gt; &lt;ns1:SerialNumber&gt;PB4LAX6JLJT7M&lt;/ns1:SerialNumber&gt; &lt;ns1:PercentProgress&gt;50&lt;/ns1:PercentProgress&gt; &lt;ns1:ResultID&gt;5&lt;/ns1:ResultID&gt; &lt;/ns1:HardDriveStatusUpdate&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; </code></pre> <p>The real problem is definitely the server side. The function is NOT getting the arguments even though all parameters are already been sent in SOAP request. Why is that? I tried a different method and it still fails to get the second argument. It only works with the FIRST argument.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload