PHP SoapClient creating XML references for identical elements, makes it unacceptable for service(PHP SoapClient 为相同元素创建 XML 引用,使其无法用于服务)
问题描述
我正在使用 PHP 开发 SOAP 客户端,并且调用可以很好地传递给服务,但存在彼此相同的元素的调用除外.似乎发生这种情况时,而不是创建两个独立但相同的元素,如下所示:
I am working on a SOAP client in PHP, and the calls are going through to the service fine, with the exception of calls where there are elements that are identical to each other. It seems that when this happens, rather than creating two separate but identical elements, like this:
<ns1:someelement>
<ns1:name>name1</ns1:name>
<ns1:value>value1</ns1:value>
</ns1:someelement>
<ns1:someelement>
<ns1:name>name1</ns1:name>
<ns1:value>value1</ns1:value>
</ns1:someelement>
它坚持只制作元素的一个副本并为其分配一个 ID,并对该元素的任何后续实例使用 href(如下所示),而我正在使用的网络服务不支持(我不支持)知道这是为什么,但这并不重要,因为我无法改变它)
it is insisting on making only one copy of the element and assigning it an ID, and using href for any subsequent instances of that element (shown below), which is not supported by the webservice I am using (I don't know why this is, but it doesn't really matter because I cannot change it)
<ns1:someelement id="#ref1">
<ns1:name>name1</ns1:name>
<ns1:value>value1</ns1:value>
</ns1:someelement>
<ns1:someelement href="#ref1" />
所以我的问题是如何强制 XML 包含完整的重复元素,而不是使用 hrefs/ids.我检查了 PHP SoapClient 的文档以获取选项或类似内容,但找不到任何内容.任何帮助或建议将不胜感激.谢谢.
So my question is how might I force the XML to come out with the duplicate elements included in full, rather than them using hrefs/ids. I checked the docs for PHP SoapClient for an option or something of the sort, but couldn't find anything. Any help or advice would be greatly appreciated. Thanks.
推荐答案
SoapClient 仅在您在多个 XML 节点上使用同一对象时才进行引用.如果您不想要引用,请为每个位置创建一个新对象.
SoapClient makes a reference only when you use the same object on multiple XML nodes. Make for each place a new object if you do not want the references.
这篇关于PHP SoapClient 为相同元素创建 XML 引用,使其无法用于服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP SoapClient 为相同元素创建 XML 引用,使其无法用


- Laravel 仓库 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01