0

来自 SoapUI 的请求

<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>

来自 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>

编写 PHP 客户端;

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;
}

错误应用程序。 致命错误:在 C:\wamp\www\spgdtws\notification.php 中调用未定义的方法 soapclient::SaasNotificationResponse()

我在 php webservice 应用程序中遇到问题。如果使用soapUI。可以调用 webservice 服务器。但是当我在客户端上使用该应用程序时。发生错误。请帮忙

4

1 回答 1

0

您似乎正在为 Telkom 的服务调用通知 WSDL。这段代码对我有用

<?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');

?>

您不需要包括 nusoap。请改用原生 PHP 的 SOAP。SoapClient 类属于原生 PHP。

供参考: http: //php.net/manual/en/class.soapclient.php

于 2013-06-28T08:01:49.080 回答