[Web Service][SOAP] Client en PHP
Bonjour a tous
j'ai un web service ecrit en .net et j'aimerai creer un client en php
le web service est ptotege par login/password.
lorsque je mets dans le code :
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 54 55 56
|
<?php
$soapClient = new SoapClient("http://ws.07zr.com/order.asmx?WSDL");
// Prepare SoapHeader parameters
$sh_param = array(
'Username' => '*************',
'Password' => '*************');
$headers = new SoapHeader('http://ws.07zr.com/order.asmx', 'UserCredentials', $sh_param);
// Prepare Soap Client
$soapClient->__setSoapHeaders(array($headers));
// Setup the RemoteFunction parameters
$ap_param = array(
'amount' => $irow['total_price']);
// Call RemoteFunction ()
$error = 0;
try {
$info = $soapClient->__call("RemoteFunction", array($ap_param));
} catch (SoapFault $fault) {
$error = 1;
print("
alert('Sorry, blah returned the following ERROR: ".$fault->faultcode."-".$fault->faultstring.". We will now take you back to our home page.');
window.location = 'main.php';
");
}
if ($error == 0) {
$auth_num = $info->RemoteFunctionResult;
if ($auth_num < 0) {
// Setup the OtherRemoteFunction() parameters
$at_param = array(
'amount' => $irow['total_price'],
'description' => $description);
// Call OtherRemoteFunction()
$trans = $soapClient->__call("OtherRemoteFunction", array($at_param));
$trans_result = $trans->OtherRemoteFunctionResult;
} else {
// Record the transaction error in the database
// Kill the link to Soap
unset($soapClient);
}
}
?> |
je reçois l'erreur :
Citation:
Warning: SoapClient::SoapClient(
http://ws.07zr.com/order.asmx?WSDL) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in C:\wamp\www\WebContent\index.php on line 27
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://ws.07zr.com/order.asmx?WSDL" in C:\wamp\www\WebContent\index.php on line 27
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ws.07zr.com/order.asmx?WSDL' in C:\wamp\www\WebContent\index.php:27 Stack trace: #0 C:\wamp\www\WebContent\index.php(27): SoapClient->SoapClient('http://ws.07zr....') #1 {main} thrown in C:\wamp\www\WebContent\index.php on line 27
est ce que je doit utiliser un proxy ou bien y a t'il une configuration specifique ?
merci