来自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>
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;
}
错误申请。 致命错误:在C:\ wamp \ www \ spgdtws \ notification.php中调用未定义的方法soapclient :: SaasNotificationResponse()
我在php webservice应用程序中遇到了问题。如果使用soapUI。可以调用webservice服务器。但是当我在客户端上使用该应用程序时。发生错误。请帮忙
答案 0 :(得分: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。