2013-04-19 6 views
0

Demande de SoapUIPHP: erreur Webservice soapclient

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:not="http://xxx.xxx.xxx.com/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <not:SaasNotificationResponse> 
     <hostID>UCALL</hostID> 
     <orderID>1180000335810000000010</orderID> 
     <custID>1180000335770000000010</custID> 
     <typeTransaction>SUSPENSION</typeTransaction> 
     <status>3</status> 
     <message>SUSPENSION 1180000335770000000010</message> 
     <notifyAttr> 
      <name>?</name> 
      <value>?</value> 
     </notifyAttr> 
     </not:SaasNotificationResponse> 
    </soapenv:Body> 
</soapenv:Envelope> 

Réponse De SoapUI:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
     <ns2:SaasNotificationResponseResponse xmlns:ns2="http://xxx.xxxx.xxx.com/"> 
     <return>F</return> 
     <return>Invalid TypeTransaction</return> 
     </ns2:SaasNotificationResponseResponse> 
    </S:Body> 
</S:Envelope> 

Codding PHP Client;

require_once('lib/nusoap.php'); 
try { 
    $client = new SoapClient("http://xxx.xxx.xxx/Notification?WSDL");  
    $data = array('hostID' => 'UCALL', 
     'orderID' => '1180000335810000000010', 
     'custID' => '1180000335810000000010', 
     'typeTransaction' => 'ACTIVATION', 
     'status' => '3', 
     'message' => 'Activation complete', 
     'notifyAttr' => array(
      array('name'=>'AccountID','value'=>'110022101010'), 
      array('name'=>'PackageID','value'=>'1') 
     ) 
); 

    $return=$client->SaasNotificationResponse($data); 
    //$return=$client->call('SaasNotificationResponse',($data));   
    print_r($return);  
}catch (SoapFault $e){ 
    echo $e; 
} 

Error Application. Fatal error: Call to undefined method soapclient::SaasNotificationResponse() in C:\wamp\www\spgdtws\notification.php

J'ai un problème dans les applications php webservice. si vous utilisez soapUI. Le serveur webservice peut être appelé. mais quand j'utilise l'application sur le client. erreur se produit. S'il vous plaît aider

+0

vérifier le chemin de la classe de savon –

+0

ce travail? $ client -> __ soapCall ("SaasNotificationResponse", $ data); –

+1

essayez ce '$ client -> __ getFunctions();' pour vérifier que la méthode 'SaasNotificationResponse' existe ou non. – som

Répondre

0

Il semble que vous appelez la notification WSDL pour le service de Telkom. ce code fonctionne pour moi

<?php 
function sendNotification($orderID,$custID,$typeTransaction,$status,$message) { 
    try { 
     $client = new SoapClient("XXXXXXXXX/Notification?wsdl",array("trace"=>1,"exceptions"=>1)); 

     $data = array('hostID' => '', 
       'orderID' => $orderID, 
       'custID' => $custID, 
       'typeTransaction' => $typeTransaction, 
       'status' => $status, 
       'message' => $message, 
       'notifyAttr' => array(
        array('name'=>'','value'=>''), 
        array('name'=>'','value'=>'') 
       )    
     ); 


     $return=$client->SaasNotificationResponse($data); 

    var_dump($return); 

    }catch (SoapFault $e){ 
     echo $e; 
    } 
} 
sendNotification('1180000339980000000010','4720562','TERMINATION','3','TERMINATION success'); 

?> 

Vous n'êtes pas obligé d'inclure nusoap. Utilisez plutôt le SOAP de PHP natif. La classe SoapClient appartient à PHP natif.

pour référence: http://php.net/manual/en/class.soapclient.php