Note that there are some explanatory texts on larger screens.

plurals
  1. POSOAP fault: object not set to an instance of an object
    primarykey
    data
    text
    <p>I found this question on here: <a href="https://stackoverflow.com/questions/927566/php-soap-issue-server-was-unable-to-process-request-object-reference-not-s">PHP Soap Issue: Server was unable to process request. ---&gt; Object reference not set to an instance of an object</a></p> <p>I have a similar issue, only the WSDL is private, so I figured I'd try and get a basic timezone SOAP Client working.</p> <p>The solution in the other question isn't possible for me to use with the private WSDL.</p> <pre><code>$response = $client-&gt;getTimeZoneTime(array('timezone'=&gt;'ZULU')); </code></pre> <p>Really what I need is a way of taking a multidimensional PHP array and putting it into the SOAP formed XML document, without it going crazy and producing stuff like, for this example, this:-</p> <pre><code>&lt;key&gt;GetTimeZoneTime&lt;/key&gt; &lt;item&gt;ZULU&lt;/item&gt; </code></pre> <p>Here's my PHP:</p> <pre><code>try { $WSDL = 'http://www.nanonull.com/TimeService/TimeService.asmx?WSDL'; $client = new SoapClient($WSDL, array( "trace" =&gt; 1, "exceptions" =&gt; 1, "soap_version" =&gt; SOAP_1_1 )); $xml = '&lt;GetTimeZoneTime&gt;&lt;timezone&gt;ZULU&lt;/timezone&gt;&lt;/GetTimeZoneTime&gt;'; $xmlvar = new SoapVar( $xml, XSD_ANYXML ); $response = $client-&gt;getTimeZoneTime($xmlvar); echo "&lt;pre&gt;\n"; echo "Request :\n".htmlspecialchars($client-&gt;__getLastRequest()) ."\n"; echo "Response:\n".htmlspecialchars($client-&gt;__getLastResponse())."\n"; echo "&lt;/pre&gt;"; } catch (SoapFault $exception) { echo "&lt;pre&gt;\n"; echo "Request :\n".htmlspecialchars($client-&gt;__getLastRequest()) ."\n"; echo "Response:\n".htmlspecialchars($client-&gt;__getLastResponse())."\n"; echo $exception; echo "&lt;/pre&gt;"; } </code></pre> <p>This is the request it produces:</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://www.Nanonull.com/TimeService/"&gt; &lt;SOAP-ENV:Body&gt; &lt;GetTimeZoneTime&gt; &lt;timezone&gt;ZULU&lt;/timezone&gt; &lt;/GetTimeZoneTime&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; </code></pre> <p>And the SOAP Fault is:</p> <pre><code>Server was unable to process request. ---&gt; Object reference not set to an instance of an object. </code></pre> <p>What's the correct way of turning a multidimensional PHP array into the appropriate format for a SOAP request?</p> <p>What does the SOAP fault returned actually mean?</p> <p><strong>Edit:</strong> After some searching around elsewhere I thought I'd try the approach of creating a PHP class to mirror the variables on the server. This doesn't work either.</p> <pre><code>class TimeZone { public function __construct () { $this-&gt;timezone = 'ZULU'; } } $WSDL = 'http://www.nanonull.com/TimeService/TimeService.asmx?WSDL'; $client = new SoapClient($WSDL, array( "trace" =&gt; 1, "exceptions" =&gt; 1, "soap_version" =&gt; SOAP_1_1 )); $xmlvar = new SoapVar(new TimeZone(), SOAP_ENC_OBJECT, "TimeZone"); $response = $client-&gt;getTimeZoneTime($xmlvar); </code></pre>
    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.
    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