Reputation: 81
I am using SOAP in PHP.
At the moment I am submitting the tag
<TAG>DATA</TAG>
But I want to submit
<TAG parameter=value>DATA</TAG>
For the life of me, I can't find out how to do this. I don't even know what this parameter=value pair is referred to as?
Can anyone help please?
Upvotes: 1
Views: 681
Reputation: 81
Okay - after a bit of hard looking, and a lucky google, I have found out the answer to my own question.
To add a parameter (or several) to an XML tag you would use the 'soapvar' command like this :
$xmlvar = soapvar('<anyType xsi:type="InvoiceLine">'.$line_xml.'</anyType>',XSD_ANYXML)
This will produce the following xml :
<anyType xsi:type="InvoiceLine"><otherstuff>data</otherstuff></anyType>
So all well and good. Problem is with this appoach is that you need to be able to isolate the 'otherstuff' that goes in the middle of the tag sandwich - in this case it's the $line_xml variable. As long as you can do this, this approach seems to work just fine.
Upvotes: 1