开发者

xsi:nil="true" in soap request

I have xsi:nil="true" in my soap reque开发者_如何转开发st. What does mean? How can I pass value on that?

Any help is appreciated


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜