I am trying to return the following object in a Web Service using WSSD 5.1.2's Web Service wizard.
Classification - defined in the Web Service's dynamic web project --String code --String description --PriceCategory priceCategoryList
PriceCategory - defined in a Java application project defined as a Java JAR Dependcy for the Web Service project --String code --String description --Date startTime --Date endTime
I create my WSDL using the Web Service wizard within WSSD. The wizard generates a new PriceCategory class (along with helper classes) in my Web Service project. This generated class contains the same attributes as above, though the Date attributes are now defined as Calendar attributes.
After WSDL generation, I tried testing using the Web Services Explorer, receiving an error about one of the helper classes trying to use a getter for the startTime attribute and expecting it to be returning a Calendar item. Since the Class Loader defines the parent first, it was hitting the getter for my originating class, which dealt with a Date attribute. I'm completely unsure about how the helper class knew it was to receive a Calendar vs a Date.
I was able to "resolve" the issue three ways:
Delete the generated PriceCategory class from my Web Service project. I did not delete any of the generated helper classes.
Change the generated PriceCategory class to have Date attributes rather than Calendar attributes.
Create my own PriceCategory class in the Web Service project that wraps the originating class. My new PriceCategory class contained Calendar attributes.
Option 2 seems to be a bad choice. I don't like deleting things from my project that were created by the wizard, as in Option 1. Option 3 seems like the only way to go, but it sure adds a lot of work for our developers trying to front existing transactions with Web Services. We are already wrapping any classes that contain collections so they make use of arrays instead. Adding in a need to wrap class containing Dates would mean we would have to wrap almost every class needed to return an object with a Web Service.
I would like to hear any thoughts on how you have addressed this issue. Any opinions on our solution would be great as well.
Barry [ October 11, 2004: Message edited by: Barry Hess ]
I'm still in control here. LOOK at this tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss