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.

By service’s api I should pass attributes and text value of node:

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

How to do that?

When I pass assoc-array like this:

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

I get:

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

And, of course, if I try this

Volume => 192 

I get:


But I need both

Add Comment
1 Answer(s)

Thanks to @giulp for pointing to 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'] 
Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.