SOAP-ERROR:编码:对象没有属性 [英] SOAP-ERROR: Encoding: Object has no property

查看:30
本文介绍了SOAP-ERROR:编码:对象没有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个如下所示的 SOAP 请求:

I need to create a SOAP request which looks like this:

<soapenv:Body>
<getItemsForProject>
   <token>
      <user>?</user>
      <password>?</password>
   </token>
   <projectId></projectId>
   <start>0</start>
   <count>0</count>
</getItemsForProject> 
</soapenv:Body>

操作期望:

[209] => struct getItemsForProject {
 wsAuth token;
 long projectId;
 int start;
 int count;
}

我尝试了以下操作,但一直遇到 PHP 致命错误:SOAP-ERROR: Encoding: object has no 'start' property

I have tried the following but keep hitting PHP Fatal error: SOAP-ERROR: Encoding: object has no 'start' property

我知道令牌对象可以这样创建,因为我已经将它用于另一个操作:

I know that the token object can be created like this, as I have used it for another operation:

$auth->token = new \stdClass;
$auth->token->user = $username;
$auth->token->password = $password;

但是,对 'start' 参数执行类似操作失败并显示致命错误消息.这是代码的一部分:

However, doing something similar for the 'start' parameter is failing with the fatal error message. Here's part of the code:

$opts = new \StdClass;
$opts->projectId = 123;
$opts->start = 0;
$opts->count = 0;

$resp = $soap->getItemsForProject($auth, $opts);       

echo $soap->__getLastRequest() ."\n";

我无法使用 $soap->__getLastRequest() 打印完整的 soap 请求,因为它在发出请求之前返回致命错误.同样,我不能在 $resp 上使用 var_dump() 因为它在执行该行之前就死了.我怎么知道实际发送的是什么?!如果我知道这一点,那么我可以更轻松地调试它.

I am unable to print the full soap request using $soap->__getLastRequest() because it is returning the fatal error before issuing the request. Similarly, I cannot use var_dump() on the $resp because it dies before executing that line. How can I tell what is actually being sent?! If I know that, then I can debug this more easily.

谢谢,ns

推荐答案

尝试类似的方法:

$myClass->token = new \stdClass;
$myClass->token->user = $username;
$myClass->token->password = $password;

$myClass->projectId = 123;
$myClass->start = 0;
$myClass->count = 0;


$resp = $soap->getItemsForProject($myClass);       

这篇关于SOAP-ERROR:编码:对象没有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆