1

I am struggling in adding an attribute to a SoapVar-Element. This is the structure i want to creat:

<SOAP-ENV:Body>
    <ns:ServiceRequest>
        <ns:Method>PING</ns:Method>
        <ns:Property Name="name1">foo</ns:Property>
        <ns:Property Name="name2">bar</ns:Property>
    </ns:ServiceRequest>
</SOAP-ENV:Body>

but this is all i get:

<SOAP-ENV:Body>
    <ns1:ServiceRequest>
        <ns1:Method>PING</ns1:Method>
        <ns1:Property>foo</ns1:Property>
        <ns1:Property>bar</ns1:Property>
    </ns1:ServiceRequest>
</SOAP-ENV:Body>

This is my code to create one of the "Property"-nodes:

$node = new SoapVar( 'foo', XSD_STRING, null, null, 'Property', $namespace);

I already tried replacing the 'foo' with an array or an object but nothing worked.

$Property['_'] = 'foo';
$Property['Name'] = 'name1';
$node = new SoapVar( $Property, SOAP_ENC_OBJECT);

... which results in:

<_>foo</_>
<Name>name1</Name>

Let me know if you need more information

h00ligan
  • 414
  • 1
  • 5
  • 12

0 Answers0