PHP与JAVA通信之 SOAP

随矜而去BLOG 2011-09-20

首先开启php.ini里的extension=php_soap.dll

把php_soap.dll复制到windows去

php的简单代码

<?php

$wsdl="http://localhost:8080/axis2/services/CalculateService?wsdl";

//setupwebserviceclient

$client=newSoapClient($wsdl);

//setupparameter

$parms=array("x"=>1,"y"=>2);

//calltheplusmethod

$response=$client->plus($parms);

echo$response->return;

?>

简单说明:

1.首先建立webservice访问对象

2.设置参数x和y的值

3.访问plus方法,计算x与y的和

4.输出返回结果

相关推荐