PHP SoapClient 为相同元素创建 XML 引用,使其无法用于服务

PHP SoapClient creating XML references for identical elements, makes it unacceptable for service(PHP SoapClient 为相同元素创建 XML 引用,使其无法用于服务)
本文介绍了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 引用,使其无法用于服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Subtract time in PHP(在 PHP 中减去时间)
Limit execution time of an function or command PHP(限制函数或命令 PHP 的执行时间)
How to sum N number of time (HH:MM Format)?(如何求和 N 次(HH:MM 格式)?)
How to get current time in milliseconds in PHP?(如何在 PHP 中以毫秒为单位获取当前时间?)
How to check if time is between two times in PHP(如何检查时间是否在 PHP 中的两次之间)
Convert number of minutes into hours amp; minutes using PHP(将分钟数转换为小时数分钟使用 PHP)