PHP调用Java WebService


header("Content-Type: text/html; charset=utf-8");
require_once("lib/nusoap.php");
// 要访问的webservice路径
$NusoapWSDL="http://localhost:8080/myWebService/services/SendMoblieMsg?wsdl";
// 生成客户端对象
$client = new soapclient($NusoapWSDL, true);
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
// 设置参数(注意:PHP只能以'数组集'方式传递参数,如果服务端是java,用Map接收)
$param = array( 'in0' => 'E090500001',
    'in1'      => '张三',
    'in2'    => '2009-05-19');
// 调用远程方法
$result = $client->call('checkLogin', array($param));
// 显示执行结果
if (!$err=$client->getError()){  
	foreach ($result as $row){
		echo $row;
	}	
}else{  
 echo '错误 : '.$err;  
}  

你可能感兴趣的:(java,PHP,webservice)