I am trying to interact with a payment gateway (FirstData). So far, I have created the cURL request, and finally got it working. Now I am to the point to where I can generate XML’s wrapped in SOAP. I am receiving an error that says:
Input SOAP Request isn’t well-formed. The Exception is org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.
Here is the xml I am feeding it:
$this->xml = "<?xml version=\"1.0\"?>";
$this->xml = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">";
$this->xml = "<SOAP-ENV:Header />";
$this->xml = "<SOAP-ENV:Body>";
$this->xml = "<fdggwsapi:FDGGWSApiOrderRequest xmlns:fdggwsapi=\“http://secure.linkpt.net/fdggwsapi/schemas_us/fdggwsapi\">";
$this->xml = "<v1:Transaction xmlns:v1=\"http://secure.linkpt.net/fdggwsapi/schemas_us/v1\">";
$this->xml = "<v1:CreditCardTxType>";
$this->xml = "<v1:Type>sale</v1:Type>";
$this->xml = "</v1:CreditCardTxType>";
$this->xml = "<v1:CreditCardData>";
$this->xml = "<v1:CardNumber>4012000033330026</v1:CardNumber>";
$this->xml = "<v1:ExpMonth>12</v1:ExpMonth>";
$this->xml = "<v1:ExpYear>12</v1:ExpYear>";
$this->xml = "</v1:CreditCardData>";
$this->xml = "<v1:Payment>";
$this->xml = "<v1:ChargeTotal>12</v1:ChargeTotal>";
$this->xml = "</v1:Payment>";
$this->xml = "</v1:Transaction>";
$this->xml = "</fdggwsapi:FDGGWSApiOrderRequest>";
$this->xml = "</SOAP-ENV:Body>";
$this->xml = "</SOAP-ENV:Envelope>";
return $this->xml;
I’m not able to find much about this, and have tried everything. Here are the headers I am sending through my cURL request:
$headers = array(
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/xml",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: \"run\"",
"Content-length: ".strlen($this->genXML()),
);
*genXML() houses the XML message with the XML listed above
Any info is appreciated.
Do you mean
$this->xml .= "..."? Otherwise it’s just overwriting the string each time, right?