当前位置:首页 > PHP > 正文内容

php调用 java webservice接口

高老师7年前 (2017-09-17)PHP1652

php调用Webservice基本语法如下:

$url ='xxxxxxx.cn' 
//链接服务器端
$client = new SoapClient($url);

通过以上语法已经连接到webservice,也可将wsdl在本地使用,下面的语法将输出所有webservice的方法

$client->__getFunctions()

获得了soap的所有操作方法,我们需要通过以下方法来看某个方法的传参数格式

var_dump($client->__getTypes());

以上输出的结果中如下格式:

array(32) {    
[0]=>    
string(61) "struct registEx {    
string arg0;    
string arg1;    
string arg2;    
}"    
[1]=>    
string(40) "struct registExResponse {    
int return;    
}"

我找到我需要操作的方法registEx(),看到需要传参3个参数,分别是arg0,arg1,arg2,开始传参调用

$url = 'xxxxxx.cn';
//链接服务器端
$client = new SoapClient($url);
$paras=array(array('arg0'=>"HBSDK-99566JCSST",'arg1'=>"Baimuvkey",'arg2'=>'220546'));
$reinfo = $client->__soapCall('registEx',$paras);
var_dump($reinfo);

或许很多人有疑问参数为什么都是arg格式,不是直接操作原函数直接传参,我猜测可能是因为php为了统一操作而这样使用的把

扫描二维码推送至手机访问。

版权声明:本文由高久峰个人博客发布,如需转载请注明出处。

本文链接:https://blog.20230611.cn/post/42.html

分享给朋友:

“php调用 java webservice接口” 的相关文章

php将html转为pdf,php将html页面导出pdf

php将html转为pdf,php将html页面导出pdf

首先下载wkhtmltox-0.12.4_linux-generic-amd64.tar.xz   (不要下载RPM包,依赖太多,需要x-server支持),并解压,执行测试运行正常tar wkhtmltox-0.12.4_linux-generic-amd64.tar.xzcd...

 php mysql 行锁,php mysql 行级锁,php mysql 行锁定

php mysql 行锁,php mysql 行级锁,php mysql 行锁定

应用场景:PHP模拟购买,商品数量大于0才能购买常见代码:<?php //连接数据库 $con=mysqli_connect("localhost","ihuohuo","927464cy","ihuohuo");...

php 数组转换xml,php 数组转成xml,php数组转xml 函数

php 数组转换xml,php 数组转成xml,php数组转xml 函数

源码:特别适用于微信支付中通知微信支付网关function array2xml($arr, $level = 1) { $s = $level == 1 ? "<xml&g...

php soap 捕获异常,使用try catch 捕获Soap 异常

php soap 捕获异常,使用try catch 捕获Soap 异常

项目中使用服务来执行webservice,由于对方系统api不稳定,经常导致服务崩溃,只能重启,一个月差不多要重启一次。初期的解决办法是捕获异常,然后continue掉。<?php try {     $url = 'http...

swoole中的worker_num和task_worker_num

swoole中的worker_num和task_worker_num

(1)swoole启动的主进程是master进程负责全局管理,然后master进程会再fork一个manager进程。(2)manager进程开始统一管理进程创建回收管理。(3)manager进程根据设置的worker_num和task_worker_num来创建work进程和task进程因此启动s...

php端口复用,php socket端口复用

php端口复用,php socket端口复用

第一次听说端口复用是在mixphp最新版本中发现的,mixphp启动监听9501端口,现在作者说可以多开几个进程来执行mixphp,我心里想了下再启动不是会端口冲突嘛,但是却没有问题,于是下载mixphp的源码解读,原来是启动http服务器使用new Co\Http\Server('0.0....