php呼叫java開發的webservice介面封包soap:Server: Fault occurred while processing
請求的資料
Array ( [sTicket] => {"username":"3ab6e844ca851bf318294a4f30f4a03e","password":"449924A9471E628995E503E34E95858" ":"http://www. city-office.com.cn/goods.php?id=60698"} )
php呼叫介面引用nusoap類別 用$client->call()方法
上一個介面用同樣的方法存取可以 到這個方法就不行了為什麼
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 '已交换';
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>" ;
}
}
你不應該貼出你的nusoap_client類麼,用try-catch去捕捉異常。在輸出錯誤之前$client->__getLastRequest(),去取得你要求的xml資料,並且列印錯誤有用資訊getMessage。且soap內部有封裝getTrace去取得異常追蹤資訊。遇到這種問題一步一步調試就好了的。