PHP SoapClient为相同的元素创建XML引用,使其无法接受服务 [英] PHP SoapClient creating XML references for identical elements, makes it unacceptable for service

查看:74
本文介绍了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(如下所示),而我使用的Web服务不支持(我不知道为什么会这样,但这并不重要,因为我无法更改)

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引用,使其无法接受服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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