Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未正确生成空变量_Php_Soap - Fatal编程技术网

Php 未正确生成空变量

Php 未正确生成空变量,php,soap,Php,Soap,Apache2.2.32上的PHP5.6.30 我正试着打电话给SoapClient。请求结构中的一个类有很多属性,其中大多数必须作为xsi:nil=“true”发送。下面是一个简单的类作为示例 class myClass { public $attribute1; public $attribute2; public $attribute3; } 当我发送请求时,不分配任何内容(或所有属性都为null)的XML生成如下(跳过soap环境等): 我所期望的是 <ns1:c

Apache2.2.32上的PHP5.6.30

我正试着打电话给SoapClient。请求结构中的一个类有很多属性,其中大多数必须作为
xsi:nil=“true”
发送。下面是一个简单的类作为示例

class myClass {
  public $attribute1;
  public $attribute2;
  public $attribute3;
}
当我发送请求时,不分配任何内容(或所有属性都为null)的XML生成如下(跳过soap环境等):


我所期望的是

<ns1:class>
  <ns1:attribute1 xsi:nil="true" />
  <ns1:attribute2 xsi:nil="true" />
  <ns1:attribute3 xsi:nil="true" />
</ns1:class>

如果我给attribute2赋值,那么XML将以如下方式生成:

<ns1:class>
  <ns1:attribute1 xsi:nil="true">
    <ns1:attribute2>my_value</ns1:attribute2>
    <ns1:attribute3 xsi:nil="true"></ns1:attribute3>
  </ns1:attribute1>
</ns1:class>

我的价值观
显然远程服务器不接受我的请求

对这个问题有什么想法吗

顺便说一句,我没有提供WSDL,因为我首先需要请求许可


谢谢你

这似乎不是问题,在某一点上,当捕捉到我的回应时,浏览器(尝试过Safari和FireFox)解释了这一点,我不知道为什么会产生错误的显示。使用原始数据(即将其写入日志文件或类似文件)可以在没有这种奇怪行为的情况下获得正确的输出。

您需要显示代码。您可以创建一个替换了所有专有名称的WSDL版本吗?
<ns1:class>
  <ns1:attribute1 xsi:nil="true">
    <ns1:attribute2>my_value</ns1:attribute2>
    <ns1:attribute3 xsi:nil="true"></ns1:attribute3>
  </ns1:attribute1>
</ns1:class>