I am working on a website that will use some API's and encountered a problem. Could somebody please help me? There is this method called "createOrder", that is killing me. It is used to create order at a supplier, as follows:
$id=$_POST['varname'];
echo $id;
$ilosc=$_POST['ilosc'];
echo "</br> Zamawiana ilosć to :";
echo $ilosc;
$orderInfo = $client->createOrder(
array(
'description'=> 'OPIS',
'clientNr' => '025537',
'type' => 'FV_ZBIORCZA',
'transport' =>'AD',
'positions' => array(
'id'=>$id,
'count'=>$ilosc
)
) ) ;
var_dump($orderInfo);
The problem is that it doesn't pass the "positions". It only creates a blank order (with these four first parameters). The problem is in my opinion that these "positions" block is designed to handle more than one item, so it has to be written in some different way.
Here is SOAP UI code for some help. It works with only "id" and "count" filled in (and api_keys as well of course) :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://katalog.adpolska.pl/ws/api/1.0/">
<soapenv:Header>
<personal_key>?</personal_key>
<kh_kod>?</kh_kod>
<api_key>?</api_key>
</soapenv:Header>
<soapenv:Body>
<ns:createOrder>
<order>
<!--You may enter the following 5 items in any order-->
<description>OPIS</description>
<clientNr>025537</clientNr>
<type>FV_ZBIORCZA</type>
<transport>AD</transport>
<positions>
<!--Zero or more repetitions:-->
<item>
<!--You may enter the following 4 items in any order-->
<productId>
<!--You may enter the following 2 items in any order-->
<id>824210</id>
<index></index>
</productId>
<count>2</count>
<error></error>
<errorMessage></errorMessage>
</item>
</positions>
</order>
</ns:createOrder>
</soapenv:Body>
</soapenv:Envelope>
Below the example from documentation, but this documentation has so many mistakes that I no longer look at it, and it also isnt working, but gives the idea:
$orderInfo = $client->__soapCall('createOrder', [
'order' => [
'description' =>'myDesc',
'clientNr' =>'my_cart_nr',
'type' =>'FV',
'transport' =>'AD',
'positions' => [
[
'id' =>'907972',
'count' => 1
],
[
'id' =>'908015',
'count' => 1
]
]
]
]);
I've also used something like wsdltophp, and extracted structure of this function:
<?php
Array
(
[0] => ADStructOrder Object
(
[description] => OPIS
[clientNr] => 025537
[type] => FV_ZBIORCZA
[transport] => AD
[positions] => ADStructArrayOfOrderPosition Object
(
[item] => Array
(
[0] => ADStructOrderPosition Object
(
[productId] => ADStructProductId Object
(
[id] => 823514
[index] =>
)
[count] => 1
[error] =>
[errorMessage] =>
)
)
)
)
?>
Could you please help me to achive working solution? Thanks in advance.