#!/usr/bin/perl use LSIxml; # Parse the XML input my $result = LSIxml::parseCGI(); # Parse error, $result is the error message if (ref $result ne "ARRAY") { # *** Possibly log error for your system here *** # Return an error element my $error = new LSIxml::Error; $error->message("Read/parse error"); $error->description($result); print "Content-type: text/xml\n"; print "Status: 200 OK\n"; print "\n"; print "\n"; print $error->as_xml; # Successful parse - update status, build return document } else { my $status_ack = new LSIxml::StatusAcknowledge; # For each status update foreach $status (@$result) { my $order_id = $status->order_id; # LSI order ID my $cust_ref_id = $status->cust_ref_id; # Your order ID/reference ID my $order_status = $status->status; # Order status my @item_statuses = @{$status->items}; # LSIxml::ItemStatus objects my @shipments = @{$status->shipments}; # LSIxml::Shipment objects if applicable my $success = 1; my $error_message = ""; my $ack; # *** Here, you can update the order in your system, set $success to 0 # *** if failed, and set $error_message to return to LSI # Acknowledge success if ($success) { $ack = new LSIxml::StatusSuccess; $ack->order_id($order_id); $status_ack->add($ack); # Report error } else { $ack = new LSIxml::StatusError; $ack->order_id($order_id); $ack->message($error_message); $status_ack->add($ack); } } # Write the return document print "Content-type: text/xml\n"; print "Status: 200 OK\n"; print "\n"; print "\n"; print $status_ack->as_xml(""); } # Finished exit(0);