How can I check for a nil=“true” value on XML that is passed back from webservice call?

StackOverflow https://stackoverflow.com/questions/7572290

  •  30-01-2021
  •  | 
  •  

Вопрос

I am receiving xml from a webservice call that contains a nil="true":

<cacheEntry>
   <systemFK nil="true"/>
</cacheEntry>

I used the Flex DataService (webservice) wizard to create the service objects for the cacheEntry component. This object will be serialized later on a different webservice call and stored in a database.

I set a breakpoint on the set SystemFK method in the service object. It appears that the value passed in was an empty string!

Allowing this value to be an empty string will cause problems in the webservice implementation in Java on the other side. Since the database value was null it is expecting a null in return, If I avoid setting this value, the serviceObject should send back a null which will make the database happy.

My question is: How can I detect that a nil = true is present in the XML in order to avoid setting this value?

Это было полезно?

Решение

For some reason the ActionScript XML parsers don't know about Booleans. Without seeing the code that got generated for you, my guess is that somehow you're getting the string "true", instead of true, and that's what's causing your problem.

Make changes to the accessors to act as if @nil comes from the XML as a string, and then convert to Boolean manually.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top