当前位置: 首页 > 工具软件 > wsdl2php > 使用案例 >

php wsdl接口调用java,php调用java web services(wsdl)

燕朝明
2023-12-01

java 接口如下:

@WebService

@SOAPBinding(style=SOAPBinding.Style.RPC)

public class SSOProxy {

@WebMethod

public UserToken findUserByTicket(@WebParam(name = "Ticket")String ticket,@WebParam(name = "SPID")String sp){

UserToken token = new UserToken();

token.setCluster("ss");

token.setName("sss");

return token;

}

}

至于javaweb services的方法,就不用说了。可以用axis2 ,cxf 等。。

php端代码:

$client = new SoapClient('http://127.0.0.1:8080/jcs/SSOProxy.asmx?wsdl');

$param1 = "p1";

$param2 = "p2";

$param = array('Ticket' => $param1,'SPID' => $param2);

$arr = $client->__soapCall('findUserByTicket',array('parameters' => $param));

foreach($arr as $key=>$v){

echo $v ."===".$key;

}

也可以下载nusoap包,在文件头里include('nusoap.php');

见附件:nusoap-0.9.5.zip

 类似资料: