USS-Connect API
order
environment = new environmentType(); $args->accountInformation = new accountType(); $args->paymentInformation = new paymentDataType(); $args->paymentInformation->paymentMethod = 'INV'; // invoice $args->orderPositions = array(); $orderPosition = new orderPositionsType(); $args->orderPositions[] = &$orderPosition; $orderPosition->orderInformation = new orderDataType(); $orderPosition->dataSourceInformation = new dataSourceDataType(); $orderPosition->shippingInformation = new shippingDataType(); $orderPosition->shippingInformation->shippingAddresses = array(); $address = new orderAddressType(); $orderPosition->shippingInformation->shippingAddresses[] = &$address; $orderPosition->shippingInformation->senderAddress = new orderAddressType(); // inital values $address->company = 'Musterfirma'; $address->firstName = ''; $address->lastName = ''; $address->street = 'Hauptstrasse 12'; $address->zipcode = '12345'; $address->city = 'Musterstadt'; $order = new orderDataType(); $order->customerProductId = 'default_flyers'; // customers product identifier $order->orderQuantity = 100; // the total of all shippingAddresses[x]->partialQuantity $order->shippingType = 'Standard'; // valid types are Standard|Express|Priority see also calculation site print24.fr $order->orderName = 'my first order'; $order->customerComment = "order sent over UP interface"; $order->customerCopy = 0; // valid amounts are 0|5|10|15 // begin processing $args->accountInformation->password = 'gast'; $args->accountInformation->customerNumber = 1600709; $args->accountInformation->portalName = 'print24'; $args->accountInformation->languageCode = 'de'; $args->accountInformation->countryCode = 'DE'; $options = array( 'soap_version' => SOAP_1_1, 'exceptions' => true, 'trace' => 1, 'cache_wsdl' => WSDL_CACHE_NONE, 'local_cert' => 'sample.cert', // your certificate file 'stream_context' => stream_context_create(['ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]]), 'charset' => 'utf8', ); // build the webservice client // test server, access with sample certificate. Download this from the Unitedprint api download page. $soap_service = "http://interface.onts.unitedprint.dev/wsdl2.1"; // real server, you need your own certificate. Contact the Unitedprint customers service. // $soap_service = "http://interface.unitedprint.com/wsdl2.1"; if (isset($_GET{'order'})) { $args->orderPositions[0]->orderInformation->customerProductId = $_GET{'customerProductId'}; // customers product identifier $args->orderPositions[0]->orderInformation->orderQuantity = $_GET{'orderQuantity'}; // customers product identifier $args->orderPositions[0]->orderInformation->shippingType = $_GET{'shippingType'}; // customers product identifier $args->orderPositions[0]->orderInformation->orderName = $_GET{'orderName'}; // customers product identifier $args->orderPositions[0]->orderInformation->customerComment = $_GET{'customerComment'}; // customers product identifier $args->orderPositions[0]->orderInformation->customerCopy = $_GET{'customerCopy'}; // customers product identifier $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->company = $_GET{'company'}; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->salutation = $_GET{'salutation'}; // valid values are Herr|Frau $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->firstName = $_GET{'firstName'}; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->lastName = $_GET{'lastName'}; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->street = $_GET{'street'}; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->zipcode = $_GET{'zipcode'}; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->city = $_GET{'city'}; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->digicode = ''; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->houseNumber = ''; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->phonePrefix = ''; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->phoneNumber = ''; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->county = ''; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->additionalLine = ''; $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->country = $args->environment->countryCode; // use only then ISO short cut $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->partialQuantity = $_GET{'orderQuantity'}; if(isset($_GET{'validate'})) { if($_GET{'validate'} == 'on') { $args->validate = 1; } } $args->orderPositions[0]->dataSourceInformation->dataSourceUser = 'username'; $args->orderPositions[0]->dataSourceInformation->dataSourcePassword = 'passw0rd'; $args->orderPositions[0]->dataSourceInformation->dataSourcePort = 21; $args->orderPositions[0]->dataSourceInformation->dataSourceHost = 'ftp://customer.tld/abcd/1234/filename.pdf'; $args->orderPositions[0]->dataSourceInformation->dataTransmission = 'download'; try { $client = new SoapClient($soap_service.'/order.wsdl', $options); } catch(Exception $e) { echo "err 1 ..: " . $e->getMessage(); } try { $erg = $client->createOrder($args); } catch(Exception $e) { echo "err 2 ..: " . $e->getMessage(); } $address->company = $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->company; $address->firstName = $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->firstName; $address->lastName = $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->lastName; $address->street = $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->street; $address->zipcode = $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->zipcode; $address->city = $args->orderPositions[0]->shippingInformation->shippingAddresses[0]->city; $order->customerProductId = $args->orderPositions[0]->orderInformation->customerProductId; $order->orderQuantity = $args->orderPositions[0]->orderInformation->orderQuantity; $order->orderName = $args->orderPositions[0]->orderInformation->orderName; $order->customerComment = $args->orderPositions[0]->orderInformation->customerComment; } else { try { $client = new SoapClient($soap_service.'/customer.wsdl', $options); } catch(Exception $e) { echo "err 1 ..: " . $e->getMessage(); } try { $erg = $client->whoAmI($args); } catch(Exception $e) { echo "err 2 ..: " . $e->getMessage(); } } echo "
party group:
" . $erg->environment->partyGroupName . "
/
" . $erg->environment->portalName . "
/
" . $erg->environment->countryCode . "_" . $erg->environment->languageCode ."
"; ?>
Account
portal
customer number (our testuser)
password
Order data
Item id to order
quantity
shipping type
Standard
Express
Priority
order name
customer comment
customer copy
0
5
10
15
Shipping address
company
salutation
Mr
Ms
firstname
lastname
street and house number
zicode
city
country
validate order only, don't commit