[XML] Comment envoyer un flux XML avec SOAP et PHP5 ?
Bonjour, je début avec SOAP.
Je développe un site e-commerce, et je dois implémenter le payement avec http://www.beanstream.com.
Dans leurs documentation ils expliquent comment leurs envoyer une transaction via un exemple en ASP:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
<%
Dim objSoapClient
Dim trnRequest
Dim trnResponse
set objSoapClient = Server.CreateObject("MSSoap.SoapClient")
objSoapClient.ClientProperty("ServerHTTPRequest") = True
call objSoapClient.mssoapinit ("http://www.beanstream.com/Soap/ProcessTransaction.wsdl")
trnRequest = "<transaction>" & _
"<merchant_id>108380000</merchant_id>" & _
"<trnType>P</trnType>" & _
"<trnCardOwner>Sam Shopper</trnCardOwner>" & _
"<trnCardNumber>5100000010001004</trnCardNumber>" & _
"<trnExpMonth>01</trnExpMonth>" & _
"<trnExpYear>05</trnExpYear>" & _
"<trnOrderNumber>1231</trnOrderNumber>" & _
"<trnAmount>500.00</trnAmount>" & _
"<ordEmailAddress>user@domain.com</ordEmailAddress>" & _
"<ordName>Sam Shopper</ordName>" & _
"<ordPhoneNumber>999-999-9999</ordPhoneNumber>" & _
"<ordAddress1>1020 Fort Street</ordAddress1>" & _
"<ordAddress2></ordAddress2>" & _
"<ordCity>Victoria</ordCity>" & _
"<ordProvince>BC</ordProvince>" & _
"<ordPostalCode>V8T4R5</ordPostalCode>" & _
"<ordCountry>CA</ordCountry>" & _
"<ref1></ref1>" & _
"<ref2></ref2>" & _
"<ref3></ref3>" & _
"<ref4></ref4>" & _
"<ref5></ref5>" & _
"</transaction>"
'Set the soap client to make an SSL connection to the Beanstream transaction server.
objSoapClient.ConnectorProperty("UseSSL") = True
'Set communication timeout to 100000 miliseconds (1 minute 40 seconds) to insure that response is received from the server. Server timout is 90 seconds.
objSoapClient.ConnectorProperty("Timeout") = 100000
'Submit the request to the Beanstream transaction server.
trnResponse = objSoapClient.TransactionProcess(trnRequest)
'Display the transction response
response.write trnResponse
'Deallocate the soap client object
Set objSoapClient = Nothing
%> |
Habituellement, âpres avoir créé mon objet SoapClient, j'interroge une méthode du fichier WSDL comme suit :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
try {
$clientSOAP = new SoapClient("http://www.beanstream.com/Soap/ProcessTransaction.wsdl", array (
'login' => $user,
'password' => $password
));
} catch (SoapFault $exception) {
}
try {
$tab = $clientSOAP->getPlans(array ('plansId' => $arg));
}
catch (SoapFault $exception)
{
echo $exception;
} |
Mais la, je dois envoyer directement un XML, ma question est donc :
Comment envoyer un flux XML avec SOAP et PHP5 ?
Merci