3

I have xsi:nil="true" in my soap request. What does mean? How can I pass value on that?

Any help is appreciated

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
rayss
  • 637
  • 2
  • 9
  • 19

2 Answers2

3

The nillable attribute indicates that the element that the attribute is on is present but has no value, similar to NULL in most programming languages.

If you want to assign a value to the element you can do so, however you'll have to remove the xsi:nil attribute first, otherwise you'll get an error.

Brian Driscoll
  • 19,373
  • 3
  • 46
  • 65
  • I cannot remove it because that is part of the soap request. Im trying to import data through API – rayss Oct 28 '10 at 13:30
1

To remove it set the value in Soap::Data object to arrayref instead of undef. say you have Field1 as your key then the Soap Data object would look like :

*bless( {
     '_name' => 'Field1',
     '_signature' => [],
     **'_value' => [
                   undef
                 ],**
     '_prefix' => 'm',
     '_attr' => {
                  'id' => '1219615'
                }
 }, 'SOAP::Data' )*

and the resulting xml would be : < m:Field1 xsi:nil=true id="1219615" /> now if you change the object to :

*bless( {
     '_name' => 'Field1',
     '_signature' => [],
     **'_value' => [],**
     '_prefix' => 'm',
     '_attr' => {
                  'id' => '1219615'
                }
}, 'SOAP::Data' )*

You will get the desired output < m:Field1 id="1219615" />. The solution is in perl.

Kiran Chaudhary
  • 124
  • 1
  • 2
  • 7