• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

XML Any Element mapping to Java  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've just started learning about web services and am struggling with the generated java code from a wsdl file.

The part of the wsdl is


Using wsimport I get my generated java code. I don't understand how to use the set_Any() and get_Any() methods.




A sample xml EToNRequest is


Can someone please explain and give examples of how to use the set_Any() and get_Any() methods to set and get the value of the xml elements? Apologies if the subject title is misleading, I'm sure if this xml or java assertion issue (if either?).


 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Even though the xsd:any type is mapped to an Object, you have to insert a DOM Element instance or a JAXB object.
To have the xsd:any type mapped to DOM Element, you can use the processContents="skip" attribute on the <any> element.
Take a look at this page: https://jaxb.dev.java.net/guide/Mapping_of__xs_any___.html
Best wishes!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!