我正在尝试与支付网关(FirstData)进行交互。到目前为止,我已经创建了 cURL 请求,并终于让它工作了。现在我可以生成包含在 SOAP 中的 XML。我收到一条错误消息:
输入 SOAP 请求格式不正确。异常是 org.xml.sax.SAXParseException:根元素之前的文档中的标记必须格式正确。
这是我正在喂它的xml:
$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;
我找不到太多关于这个的东西,并且已经尝试了一切。以下是我通过 cURL 请求发送的标头:
$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() 包含上面列出的 XML 的 XML 消息
任何信息表示赞赏。