php向Web Service传递参数 传递是否成功

wangxumin2 2018-07-10 05:15:48


传参的地址就不写了 怕出问题

$client->__getFunctions()
array(8) {
[0]=> string(44) "collectResponse collect(collect $parameters)"
[1]=> string(53) "orcReadallResponse orcReadall(orcReadall $parameters)"
[2]=> string(47) "openBillResponse openBill(openBill $parameters)"
[3]=> string(44) "orcReadResponse orcRead(orcRead $parameters)"
[4]=> string(50) "queryBillResponse queryBill(queryBill $parameters)"
[5]=> string(53) "syncResultResponse syncResult(syncResult $parameters)"
[6]=> string(35) "initResponse init(init $parameters)"
[7]=> string(35) "syncResponse sync(sync $parameters)"
}

$client->__getTypes()
array(16) {
[0]=> string(42) "struct collect { string collectRequest; }"
[1]=> string(49) "struct collectResponse { string collectReturn; }"
[2]=> string(48) "struct orcReadall { string orcReadallRequest; }"
[3]=> string(55) "struct orcReadallResponse { string orcReadallReturn; }"
[4]=> string(41) "struct openBill { anyType openRequest; }"
[5]=> string(51) "struct openBillResponse { string openBillReturn; }"
[6]=> string(42) "struct orcRead { string orcReadRequest; }"
[7]=> string(49) "struct orcReadResponse { string orcReadReturn; }"
[8]=> string(43) "struct queryBill { anyType queryRequest; }"
[9]=> string(53) "struct queryBillResponse { string queryBillReturn; }"
[10]=> string(48) "struct syncResult { string syncResultRequest; }"
[11]=> string(55) "struct syncResultResponse { string syncResultReturn; }"
[12]=> string(36) "struct init { string initRequest; }"
[13]=> string(43) "struct initResponse { string initReturn; }"
[14]=> string(36) "struct sync { string syncRequest; }"
[15]=> string(43) "struct syncResponse { string syncReturn; }"
}
$client->__getLastRequestHeaders()

Dumping request headers:
string(192) "POST /services/BWApi HTTP/1.1
Host: fapiao.ylsaas.cn:8182
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.17
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 1606

$client->__getLastRequest()


$client->__getLastResponseHeaders()
string(147) "HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Tue, 10 Jul 2018 08:28:19 GMT

$client->__getLastResponse()





目前想知道自己数据有没有穿过去 还有
$ret = $client->openBill("openBill",$openRequest); 这句到底对不对
...全文
238 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangxumin2 2018-07-12
  • 打赏
  • 举报
回复
引用 2 楼 xuzuning 的回复:
大约这样
$ret = $client->openBill(array('openRequest' => $openRequest));

请问你能给个联系方式么
wangxumin2 2018-07-12
  • 打赏
  • 举报
回复
引用 2 楼 xuzuning 的回复:
大约这样
$ret = $client->openBill(array('openRequest' => $openRequest));


Fatal error: Uncaught SoapFault exception: [soapenv:Server.userException] org.xml.sax.SAXException: Deserializing parameter 'openRequest': could not find deserializer for type {http://www.w3.org/2001/XMLSchema}anyType in D:\wwwroot\LocalUser\wxm\e\tkwht\_plugin\fapiao.php:46 Stack trace: #0 D:\wwwroot\LocalUser\wxm\e\tkwht\_plugin\fapiao.php(46): SoapClient->__call('openBill', Array) #1 D:\wwwroot\LocalUser\wxm\e\tkwht\_plugin\fapiao.php(46): SoapClient->openBill(Array) #2 {main} thrown in D:\wwwroot\LocalUser\wxm\e\tkwht\_plugin\fapiao.php on line 46
wangxumin2 2018-07-12
  • 打赏
  • 举报
回复
自顶

引用 4 楼 libo13458664896 的回复:
webserver 调用格式 网上 应该查得到 ; 至于请求的参数: 这要看 接口提供那边, 别个接受的是字符串 还是数据了; 看你的请求有没有问题, 你可以打印 $ret = $client->openBill(array('openRequest' => $openRequest)); $ret, 看返回结果是否是正常的返回吗

直接报错 无法打印 在你上一楼 对方接口是java写的

数据类型:json

BWApiService bwApiService = new BWApiService();
BWApi api = bwApiService.getBWApi();
String data = "{\"user\":\"test\",\"pwd\":\"test\",....省略一系列参数
\"pushType\":\"0\"}";
String res = api.openBill(data);
System.out.println(res);

我如果改成$ret = $client->openBill("openRequest",$openRequest);
他们说我 参数传过去的 但是是空值 说可能因为php 和java传的方式不一样导致的
我只能去弄Java写么

xuzuning 2018-07-12
  • 打赏
  • 举报
回复
大约这样
$ret = $client->openBill(array('openRequest' => $openRequest));
妖^_^十三 2018-07-12
  • 打赏
  • 举报
回复
webserver 调用格式 网上 应该查得到 ; 至于请求的参数: 这要看 接口提供那边, 别个接受的是字符串 还是数据了; 看你的请求有没有问题, 你可以打印 $ret = $client->openBill(array('openRequest' => $openRequest)); $ret, 看返回结果是否是正常的返回吗
wangxumin2 2018-07-11
  • 打赏
  • 举报
回复
自顶自顶自顶

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧