开发者

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

开发者 https://www.devze.com 2023-04-08 14:27 出处:网络
I am receiving xml from a webservice call that contains a nil=\"true\": <cacheEntry> <systemFK nil=\"true\"/>

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.

0

精彩评论

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

关注公众号