Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP SOAP Client Woes
    primarykey
    data
    text
    <p>I have a basic knowledge of SOAP using PHP but am getting stuck on what I hope turns out to be one of those "DUH" moments.</p> <p>I have a WSDL file that I use to retrieve information from a remote site and have been using it as such:-</p> <pre><code>$ordernumber = 171994; $username = "someone@somewhere.com"; $password = "secret"; $arr = array("orderNumber" =&gt; $ordernumber,"orderReference" =&gt; ''); $client = new SoapClient(BASEPATH."/feed/Orders.wsdl",array('trace' =&gt; 1)); $orders = $client-&gt;RetrieveOrder ($username,$password,'',array("orderElements" =&gt; $arr)); </code></pre> <p>That works fine for single orders and I get the information I want. However, If I want to retrieve multiple orders then I am running through a foreach loop sending a single request for each order.</p> <p>According to the documentation I should be able to provide an array of orders and retrieve multiple orders in one go, and, if I use the online tool <a href="http://soapclient.com/soaptest.html" rel="nofollow">http://soapclient.com/soaptest.html</a> and enter multiple orders then I get the expected result. The xml request that gets generated from soapclient.com is as follows:-</p> <pre><code>&lt;email xsi:type="xsd:string"&gt;someone@somewhere.com&lt;/email&gt; &lt;password xsi:type="xsd:string"&gt;secret&lt;/password&gt; &lt;messageHeader xsi:type="tns:messageHeaderElement"&gt; &lt;senderId xsi:type="xsd:string"/&gt; &lt;receiverId xsi:type="xsd:string"/&gt; &lt;messageId xsi:type="xsd:string"/&gt; &lt;transactionId xsi:type="xsd:string"/&gt; &lt;transactionTimeStamp xsi:type="xsd:dateTime"/&gt; &lt;/messageHeader&gt; &lt;orderElements xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:queryElement[2]"&gt; &lt;item xsi:type="tns:queryElement"&gt; &lt;orderReference xsi:type="xsd:int"/&gt; &lt;orderNumber xsi:type="xsd:int"&gt;171994&lt;/orderNumber&gt; &lt;/item&gt; &lt;item xsi:type="tns:queryElement"&gt; &lt;orderReference xsi:type="xsd:int"/&gt; &lt;orderNumber xsi:type="xsd:int"&gt;172101&lt;/orderNumber&gt; &lt;/item&gt; &lt;/orderElements&gt; </code></pre> <p>The messageHeader section is optional and I am just sending '' in the above call.</p> <p>Can anyone please tell me how, using PHP SOAPCLIENT that I can send one single request for multiple orders?</p> <p>Thanking you in advance :-)</p> <p>EDIT:</p> <p>Thanks @DeaconDesperado and @EM-Creations for your repsonses. @DeaconDesperado is right - I should be able to use the $client->VendaRetrieveOrder method. I have tried many ways to generate the orderElements array, the following is the most recent and in my eyes the nearest...</p> <pre><code>$orderElements = Array ( [0] =&gt; stdClass Object ( [orderNumber] =&gt; 236431 [orderReference] =&gt; ) [1] =&gt; stdClass Object ( [orderNumber] =&gt; 236431 [orderReference] =&gt; ) ) $orders = $client-&gt;VendaRetrieveOrder ($username,$password,'',array("orderElements" =&gt; $orderElements)); </code></pre> <p>But, when I use that then I get the following trapped error.</p> <pre><code>SOAP-ERROR: Encoding: object hasn't 'orderReference' property </code></pre>
    singulars
    1. This table or related slice is empty.
    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