We feel pride when we deliver professional, well managed services tailored to your needs and help you move your business forwards


We have worked with a number of clients on integrating their eCommerce solutions with 3rd Party Software for example cXML and Punchout.  Our solutions have been either fully end to end, or in the case of one project an integration layer around an existing eCommerce solution to alllow for secure credentials, and a shopping basket to be passed between the systems.


One of the recent trends when working with framework agreements is a requirement for integration between your systems and your customers systems often through an intermediary providing a consolidated procurement solution.


During our time working on these projects we've discovered a couple of useful sites and snippets of code which may help with your own projects:


For Testing your code, equalevel have provided a great test tool:



Readng the punchout setup

Our recommendation is that you read the incoming xml message and store the received  elements and attributes to a database table with a generated key.  If you're using this method to store usernames and passwords, then consider storing a datetime stamp and setting the records to expire after a given time period.

The php code below is a simple example of reading in an xml string and storing a couple of known elements to variables.


<?php $xml = file_get_contents('php://input');
if (strpos(urldecode($xml),"cXML-urlencoded=") !== False) {

$xml=ltrim($xml,"cXML-urlencoded="); $xml=substr($xml,0,strpos($xml,"</cXML>")+7); }

$xml = simplexml_load_string($xml);

$identity = $xml->Header->Sender->Credential->Identity;
$secret = $xml->Header->Sender->Credential->SharedSecret;



Responding to the setup

As a response to setting up the transaction, you should pass back a status and a URL for your shopping cart.  The below example uses a variable called token, which could be the stored identifier from the setup above. 

session_write_close(); $x=session_id();
$mytime = date('c');
$payloadid = rand(0,100000000);
$response = '<?xml version="1.0" ?>';
$response .= '<cXML payloadID="XML'.$payloadid.'" xml:lang="en-GB" timestamp="'.$mytime.'">';
$response .= '<Response>';
$response .= '<Status code="200" text="OK"/>';
$response .= '<PunchOutSetupResponse>';
$response .= '<StartPage>';
$response .= '<URL>';
$response .= 'http://www.yournextpage.com?token='.$x;
$response .= '</URL>';
$response .= '</StartPage>';
$response .= '</PunchOutSetupResponse>';
$response .= '</Response>';
$response .= '</cXML>'; header("Content-type: text/xml; charset=utf-8");
echo $response;

Passing a basket back

 The simplest method by far is to store your response in a string and to submit this back to a known URL stored in a session or in your databsae.

Included below is some additional javascript to show how to automatically post the form.

$URL = $_SESSION["ResponseURL"];

echo "<FORM ID='xmlpostform' METHOD=POST ACTION='".$URL."'>";
echo "<INPUT TYPE=HIDDEN NAME='cXML-urlencoded' VALUE='".$xml."'>";
echo "<INPUT TYPE=SUBMIT VALUE='Sending Order Information .......'>";
echo "</FORM>"; unset($_SESSION['basket']); ?> <SCRIPT LANGUAGE="JavaScript">document.forms["xmlpostform"].submit();</SCRIPT>




Quick Contact
Fill in the boxes, Click send and we'll get straight back to you.
Please enter your name!
Please enter your email!
Write your message!