我正在尝试将支付网关集成到简单的PHP站点(我自己的站点)中,并且网关只接受SOAP格式的数据。我完全不知道SOAP是什么,但感谢谷歌,我现在知道它是怎么样的(至少)。使用PHP发送SOAP请求并获取返回的响应
基本上,我需要发送一堆客户数据和支付数据到网关根据收到的响应行事。以下是示例请求代码和示例响应代码。他们只提供要发布到的网址,即http://69.94.141.22/SaveTransactions.asmx
。
请求
POST /SaveTransactions.asmx HTTP/1.1
Host: 69.94.141.22
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SendTransactionsAction xmlns="http://tempuri.org/">
<strUserName>string</strUserName>
<strPassword>string</strPassword>
<strSecureKey>string</strSecureKey>
<strFirstName>string</strFirstName>
<strLastName>string</strLastName>
<strPhoneNumber>string</strPhoneNumber>
<strStreetNumber>string</strStreetNumber>
<strUnitNumber>string</strUnitNumber>
<strStreetName>string</strStreetName>
<strCity>string</strCity>
<strState>string</strState>
<strZipCode>string</strZipCode>
<strEmailAddress>string</strEmailAddress>
<strBankName>string</strBankName>
<strRoutingNo>string</strRoutingNo>
<strAccountNumber>string</strAccountNumber>
<strCheckNo>string</strCheckNo>
<strAmount>string</strAmount>
<strNotes>string</strNotes>
</SendTransactionsAction>
</soap12:Body>
</soap12:Envelope>
响应
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<SendTransactionsActionResponse xmlns="http://tempuri.org/">
<SendTransactionsActionResult>string</SendTransactionsActionResult>
</SendTransactionsActionResponse>
</soap12:Body>
</soap12:Envelope>
如何发布这些到URL提供了使用PHP和如何获取该响应SendTransactionsActionResult
从返回的响应?
我不是要求你为我做这件事,而是像代码一样简单的开始会有很大的帮助。
在此先感谢