Documentation::putOrders

Import method for new purchase orders from dealers.

Input is a multidimensional array (struct) of tns:orders, which is a complex structure best described in WSDL. There are some optional field in this structure, so read the WSDL comments carefully.

Output is an (in)complete 2D array of tns:ordersShort, which contains distributor's order number(s) with dealers' own number submitted on input. Optionally a pairing status code(s) may be included in response, but should be ignored by the client.

Server Processing

Method processes all orders one by one, but stops processing on any error. Each head and row is checked first and each order is saved in an isolated transaction (which assures that every already processed order is saved), but there may occur any application or database error, while checking or saving each currently processed order.

If any check fails, processing is stopped, fault is returned and no more orders are saved (no new database transaction is started). Already processed orders are left saved, so client must ask for their numbers (which are not returned with fault) using getOrdersList method in addition to reporting the error to user.

If error occurs on database level, processing is stopped, fault is returned and no more orders are saved (database transaction saving currently processed order is rolled back).

If error occurs on application level (for example unhandled exception), processing is stopped, fault is returned and no more orders are saved (database transaction saving currently processed order is not executed).

When fault is returned, client is responsible for at least notifying the user that the SOAP transaction failed and must be re-processed. In addidition to this, client should ask server for numbers of already saved orders (using number_ext for pairing) and do not re-submit such orders again.

Server Processing of optional values

If address code is present and matched, address parts are dropped.

If person code is present and matched, firstname and lastname are dropped.

Delivery method code is optional, if not present default is used (if any). If additionally no default is found, server returns exception (see below).

Payment method code is optional, if not present default is used (if any). If additionally no default is found, server returns exception (see below).

Currency code is optional, if not present default is used. If additionally no default is present, CZK is used.

Server Processing of omitted values

If currency, delivery method or payment method code is omitted, server will use defaults.

If no person code is present, server will use default person code related to client. No automatic person (contact) creation is done and will not be added.

If no address is present, server will use default address code related to client. No automatic address creation is done, but will be possibly added later.

If no default is present, server returns exception when handling delivery method or payment method, so if you need to use this service, please make a call to your primary contact.

Server Processing when pairing string values

All string matching/pairing is done by comparing two strings converted to ASCII 7-bit and it is case insensitive. When multiple results found, server takes first one and does not continue to exact match.

If person code is present and not matched, server returns fault.

If person code is not present, both firstname and lastname are present and matched, server will use person code related to first matched firstname and lastname pair.

If address code is present and not matched and address parts are omitted, server returns fault.

If address code is present and not matched and address parts are present and not matched, server will create new end user address and will use it for the order. Address name is optional, but if client supplies address code (xsd:normalizedString [15]) of new address , street (xsd:normalizedString [30]), city (xsd:normalizedString [30]) and zip (xsd:normalizedString [10]) are mandatory. Element content longer than maximum specified length is truncated. that Region for new address is set to Czech Republic, but it may change in future releases.

If address code is not present, and all address parts are present and not matched, server will use address code related to first matched address parts.

Some delivery options are available only in Prague, so they are not valid in other locations. Matching is done on address zip code.

Even if order is accidentally re-submitted by the client, server returns fault because it does not accept duplicate orders (matching is done using number_ext and existing external numbers).

Server Pairing Status Codes

Letters Code Status
AR1Address matched code to code.
AR2Address not matched code to code, set to default address.
AR3Address matched each part to each part.
AR4Address not supplied, set to default address.
AR5No recipient supplied, set to default address.
AR6Address code not matched, address parts not matched and new address successfully created.
CT1Contact person matched code to code.
CT2Contact firstname and lastname supplied, but not matched, set to default.
CT3Contact person matched name to name.
CT4Neither code nor firstname and lastname supplied, set to default.
CT5No person supplied, set to default contact.
CD1Delivery method code valid.
CD2Delivery method code invalid, using default.
CP1Payment method code valid.
CP2Payment method code invalid, using default.
CC1Currency code valid.
CC2Currency code present, but invalid, using default.
CC3Currency code present, but invalid, using CZK (no default found).
CC4Currency code not present, using default.
CC5Currency code not present, using CZK (no default found).
OD0Order will be shipped in parts (divide flag set to true).
OD1Order may be optionally shipped only if all products are on stock (divide flag set to false).
PCrow numberNumber of order row where the customer price is lower than our price.

Client Behaviour

Client should do all necessary checks before submitting each order or set of orders. Weak clients should submit each order as the only input, whereas strong clients should use full capabilities of the method.

Client may immediately re-submit orders, which was not processed due to a failure of any of previous transaction, but only those, which followed the faulty order.

Fault codes

Method returns SOAP fault (according to SOAP Version 1.2, section 2.3 Fault Scenarios) on failure or when no data found for client request. Database error may be returned with specific error prefix, when database is not ready or something unwanted happens.

Code Actor String Detail
any negativeSERVERUnhandled exception.possibly anything
1CLIENTMalformed request.client input
2CLIENTEmpty request.client input
101CLIENTMalformed request, head not present.order position
102CLIENTMalformed request, number_ext not present.order position
103CLIENTDuplicate order, already saved.order position
104CLIENTMalformed request, recipient code invalid.order position
105CLIENTMalformed request, person code not found.order position
106CLIENTMalformed request, failed to create new end user address.order position
201CLIENTMalformed request, no row(s) present.order position
202CLIENTMalformed request, product code not found.order position followed by a semicolon and invalid part number
203CLIENTInvalid delivery option selected for address.order position
204CLIENTMalformed request, zero price detected.order position followed by a semicolon and invalid part number
205CLIENTInvalid payment method.order position
206CLIENTInvalid currency.order position followed by semicolon and invalid code
207CLIENTKURYR delivery option is available only from Monday to Friday at 05:00 - 12:55.order position
208CLIENTInvalid payment method for selected address.order position
209CLIENTInvalid currency for selected payment method.order position
210CLIENTOrder contains electronic license or service and code payment is 30 (cash on delivery).order position
211CLIENTOrder rows contains prices but customers prices are not enabled.order position
212CLIENTCustomer price is negative or zero.order position followed by semicolon and row number
300SERVERException occured, transaction rolled back.order position
ORA-[0-9]{1-5}DATABASEDatabase subsystem error.database error message

If order position is returned, it starts with 0 (zero) for first order in request array. Optionally it may be followed by a semicolon delimited sequence of another numbers or tokens, so client must be able to divide the string before semicolon to get the invalid order number. For example 3;RAH-66 with error 202, means that in order 4 somebody wants Commanche helicopter and we do not have them currently in our ERP (probably because we do not have a contract with Boeing-Sikorsky).

Authentication

SOAP client must be capable of basic HTTP authentication to use this method.

Delivery codes

code_deliver parameter Description
TOPstandard transportation TOPTRANS
KURYRtransportation in 4 hours - region Prague only
TOPTIMEtransportation TOPTRANS in the forenoon
TOPPRIVATevening transportation TOPTRANS

Payment codes

code_payment parameter Description
30cash on delivery
33prepayment (pro forma invoice)
34invoice with due date

Reserved orders

Type Description
0none (in case of proforma payment method (33) reservation type 1 will be applied)
1binding reservation
2not binding reservation

If customer sends proforma payment method (33), type 1 reservation will be used. In that case, the goods will be reserved for 7 days, whether it's on stock or not.

If customer sends type 1 reservation and other payment method than proforma (33), goods will be reserved for 7 days, depending on every part of order being on stock. In other case, goods will be reserved for 1 day (until the workday ends, or until the next workday ends, in case of orders saved after 4:00 P.M.)

If customer sends type 2 reservation, order will be blocked for 7 days (however, we will NOT reserve the goods).

If customer doesn't send any reservation type, type 0 will be used as default, including proforma payment method (33) process logic.

Example request

POST /index.php HTTP/1.0
User-Agent:ClTest/1.0.0 (0.99)
Host:dev.techdata.cz
Content-Type:text/xml; charset=UTF-8
SOAPAction:"http://xchgdemo.techdata.cz/index.php/putOrders"
Content-Length:2700

Example response

HTTP/1.1 200 OK
Date:Thu, 12 Aug 2004 09:36:05 GMT
Server:Apache
X-SOAP-Server:NuSOAP/0.6.8 (1.76)
Content-Length:847
Connection:close
Content-Type:text/xml; charset=UTF-8

Known bugs

SOAP fault is returned in ISO-8859-1 encoding, except of server header UTF-8 charset declaration.