如何在 SOAP 中向请求添加 XML 属性?
我需要像这样创建 SOAP 请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stor="http://storage.xdoc.xx/">
<soapenv:Header/>
<soapenv:Body>
<stor:createDocument>
<parentEntryId>workspace://SpacesStore/15f33e3a-32ba-4a5d-976f-c9e2096e1112</parentEntryId>
<name>test.txt</name>
<properties module="" name="Content" type="Binary">
<valueBinary>
<bytes>cXdlcnR5</bytes>
</valueBinary>
</properties>
</stor:createDocument>
</soapenv:Body>
</soapenv:Envelope>
据我所知,我需要使用嵌套数组,但问题出在 XML 属性中。 SoapVar 似乎不完全是我所需要的。
现在我有这样的呼吁:
$client->__callSoap("createDocument",
array(new SoapParam($name, "name"),
new SoapParam(
new SoapParam(
new SoapParam(
$contents,
"bytes"
),
"valueBinary"
),
"properties"
)
)
);
如何给“属性”添加属性?
先感谢您。
I need to create SOAP request like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stor="http://storage.xdoc.xx/">
<soapenv:Header/>
<soapenv:Body>
<stor:createDocument>
<parentEntryId>workspace://SpacesStore/15f33e3a-32ba-4a5d-976f-c9e2096e1112</parentEntryId>
<name>test.txt</name>
<properties module="" name="Content" type="Binary">
<valueBinary>
<bytes>cXdlcnR5</bytes>
</valueBinary>
</properties>
</stor:createDocument>
</soapenv:Body>
</soapenv:Envelope>
As far as I understand I need to use nested arrays, but the problem is in the XML properties. SoapVar seems to be not exactly what I need.
Now I have such a call:
$client->__callSoap("createDocument",
array(new SoapParam($name, "name"),
new SoapParam(
new SoapParam(
new SoapParam(
$contents,
"bytes"
),
"valueBinary"
),
"properties"
)
)
);
How to add attributes to "properties"?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我尝试了一些变体来完成这项工作 - 使用嵌套数组、stdClass、SoapVar 编码数组和组合等。但我发现可以正常工作的唯一变体是:
我认为它应该与属性数组一起使用也。
希望这对其他人有用。
I've tried some variants to make this work - with nested arrays, and stdClass, and SoapVar enconded arrays, and combinations, etc. But the only variant I found to be working properly is that:
I think it should work with array for properties too.
Hope this'll be useful for someone else.