i trying integrate payment gateway in simple php site (my own site) , gateway accepts data in soap format. have absolutely no idea soap is, google know how looks (at least).
basically, need send bunch of customer data , payment data gateway act according response receive. here sample request code , sample response code. provided urlto post , http://69.94.141.22/savetransactions.asmx
.
request
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>
response
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>
how post these url provided using php , how response sendtransactionsactionresult
returned response?
i not asking me, simple started codes lot.
in advance
you can archive using curl, php soapclient or nusoap
below have shown how use nusoap library
also wsdl location in http://69.94.141.22/savetransactions.asmx?wsdl
$client = new nusoap_client("http://69.94.141.22/savetransactions.asmx?wsdl", true); // should wsdl location $error = $client->geterror(); if ($error) { echo "<h2>constructor error</h2><pre>" . $error . "</pre>"; } // use basic authentication method $client->setcredentials("username", "password", "basic"); //set here credentials if need wsdl $client->setheaders('<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> '); $result = ""; if ($client) { $result = $client->call("sendtransactionsaction"); // soap action } if ($client->fault) { echo "<h2>fault</h2><pre>"; print_r($result); echo "</pre>"; } else { $error = $client->geterror(); if ($error) { echo "<h2>error</h2><pre>" . $error . "</pre>"; } else { echo "<h2>zip code</h2><pre>"; print_r($result); echo "</pre>"; } } echo "<h2>request</h2>"; echo "<pre>" . htmlspecialchars($client->request, ent_quotes) . "</pre>"; echo "<h2>response</h2>"; echo "<pre>" . htmlspecialchars($client->response, ent_quotes) . "</pre>";
Comments
Post a Comment