php calls the webservice interface developed by java and reports soap:Server: Fault occurred while processing
Requested data
Array ( [sTicket] => {"username":"3ab6e844ca851bf318294a4f30f4a03e","password":"449924A9471E628995E503E34E9F5C88"} [sMGoods] => {"goodsguid":"60698", "goodssourceurl":"http: //www.city-office.com.cn/goods.php?id=60698"} )
PHP calls the interface to reference the nusoap class using the $client->call() method
The previous interface can be accessed using the same method, but not this method. Why?
require_once('lib/nusoap.php');
$client = new nusoap_client('http://220.191.208.229/gpmall/ws/MallService?wsdl', 'wsdl','','');
$client->soap_defencoding = 'utf-8';
$client->xml_encoding = 'utf-8';
$client->decode_utf8 = false;
$username = '3ab6e844ca851bf318294a4f30f4a03e';
$pwd = '449924A9471E628995E503E34E9F5C88';
$aa1= array('username'=>$username,
'password'=>$pwd);
$aa1=json_encode($aa1);
//print_r($aa1);
$goodsparams=array('goodsguid'=>'60698',
'goodssourceurl'=>'http://www.city-office.com.cn/goods.php?id=60698',
);
$goodsparams=json_encode($goodsparams);
//print_r($goodsparams);
$arr=array('sTicket'=>"$aa1",'sMGoods'=>"$goodsparams");
print_r($arr);
$result = $client->call('exchangeGoodsURL',$arr, '', '', false, true);
if (!$err=$client->geterror()) {
//echo 'exchanged';
print_r($result);
echo '</br>';
} else {
echo 'no';
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
//print_r($result);
//echo $result['out'];
$ts=explode(',',$result['out']);
$ts1=explode(':',$ts[1]);
echo $i+1,":",$ts1[1],"</br>" ;
}
}
Shouldn’t you post your nusoap_client class and use try-catch to catch exceptions. Before outputting the error, $client->__getLastRequest() gets the xml data you requested and prints the useful error information getMessage. And there is an encapsulation getTrace inside soap to obtain exception tracking information. If you encounter this kind of problem, just debug it step by step.