简体   繁体   English

如何使用 php-soap 同时获取具有属性和文本内容的 xml-node 作为子节点?

[英]How to get xml-node with attributes and text content as child at same time with php-soap?

Trying to generate an xml-request for external webservice using php-soap.尝试使用 php-soap 为外部 Web 服务生成 xml 请求。

By service's api I should pass attributes and text value of node:通过服务的 api 我应该传递节点的属性和文本值:

<Volume type="I" determiningMethod="N">192</Volume>

How to do that?怎么做?

When I pass assoc-array like this:当我像这样传递 assoc-array 时:

Volume => [type=>"I",determiningMethod=>"N"]

I get:我得到:

<Volume type="I" determiningMethod="N"/>

And, of course, if I try this当然,如果我试试这个

Volume => 192

I get:我得到:

<Volume>192</Volume>

But I need both但我两者都需要

Thanks to @giulp for pointing to SoapParam.感谢 @giulp 指向 SoapParam。

According to this comment :根据此评论

if you need a string like this:如果你需要这样的字符串:

<Volume type="I" determiningMethod="N">192</Volume>

You should pass array like this:你应该像这样传递数组:

Volume => ['_' => 192, 'type'=>'I', 'determiningMethod'=>'N']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM