This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

array types  RSS feed

 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is something like the below valid? It looks correct but how does one go about initializing the objects?



It easily done in php by using something like: How would one do it in Java? thanks in advance.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Yes, it does look valid to me.
Have you tried to compile the XML schema that contains your type usign XJC, the JAXB XML schema compiler plugin?
It will help you generate Java classes that you can use to create object hierarchies in memory that you later serialize to XML.
If you are working in Eclipse, there is even a XJC plugin that let you do the schema compilation from within the IDE.
Best wishes!
 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thks for the reply. Yes, it does compile. I was able to wsdl2java it and it only creates the classes for the "MyArrayObjects". Meaning I was able to doing something like: This would only create something like:


The above will not work as it's expecting:


How would I do it so that it creates the above?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
From what web service stack is the wsdl2java command?
Try using the xjc command that should be included in any recent JDK.
To determine if you have the command or not, try the following in a terminal window:

I get the following output:

I suspect this is not the latest version of JAXB, but it should be recent enough.
Best wishes!
 
john s murray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I was able to deploy and generate the wsdl. however, when I use the wsdl2java tool to generate the java class files, it doesn't seem to be generating the MyArrayObjects classes. I would expect it generate class files for MyArray1Type objects and MyArrayObjects. Or a way for me to do something like:


Do I need to change it to something like?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!