I've been learning cxml for the past 2 weeks. At first its horrible. But eventually it gets easier. SO I was finally able to successfully use Punch-out Setup Request which will return the start url. I can browse the supplier website and add to cart. Now i need to transfer the items in the cart to my page. In the Punch-out Setup Request i had to provide url for that url. When i click on transfer cart, the supplier website will redirect me to mypage. Now how do i parse or even get the Punch-out Order Message in php. Here is how the punchoutordermessage should look like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
<cXML timestamp="2019-05-04T13:44:46+00:00" xml:lang="en-US" payloadID="zxysdfdsdafasdfsfdsf">
<Header>
<From>
<Credential domain='NetworkID'>
<Identity></Identity>
</Credential>
</From>
<To>
<Credential domain='NetworkID'>
<Identity></Identity>
</Credential>
</To>
<Sender>
<Credential domain='NetworkID'>
<Identity></Identity>
<SharedSecret></SharedSecret>
</Credential>
<UserAgent></UserAgent>
</Sender>
</Header>
<Message>
<Punch-outOrderMessage>
<BuyerCookie></BuyerCookie>
<Punch-outOrderMessageHeader operationAllowed="edit">
<Total>
<Money currency="USD">300.52</Money>
</Total>
</Punch-outOrderMessageHeader>
<ItemIn quantity="1">
<ItemID>
<SupplierPartID></SupplierPartID>
<SupplierPartAuxiliaryID></SupplierPartAuxiliaryID>
</ItemID>
<ItemDetail>
<UnitPrice>
<Money currency="USD">7.99</Money>
</UnitPrice>
<Description xml:lang="en"></Description>
<UnitOfMeasure>EA</UnitOfMeasure>
</ItemDetail>
</ItemIn>
</Punch-outOrderMessage>
</Message>
I've tried using simplexml_load_file. No Help. I'm not sure what exactly happens when the buyer click on transfer cart beside it will load the page that i supplied. Any help would be appreciated. There are not much information out there about cxml. Its been really hard to get any info.
<?php
$xml=simplexml_load_file("cxml_form") or die("Error: Cannot create
object");
print_r($xml);
?>
When the customer click on checkout/transfercart the supplier site send the message to ur page. However in order to receive it, you must automatic post the form. On your Page: add the following php code:
<?php $xml = file_get_contents('php://input');
$URL = "https://yourlandingpage";
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>"; ?> <SCRIPT
LANGUAGE="JavaScript">document.forms["xmlpostform"].submit();</SCRIPT>
To retrieve the value using VB.net
dim cxml as string= doc.GetElementById("cXML-urlencoded").GetAttribute("VALUE")