• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

How to remove nillable=true & minOccurs=“0” elements from SOAP envelope request?

Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm using Apache CXF 2.7.11 client to generate the stub classes from WSDL file.

In WSDL, I have few elements like :-

When JAXB is generated then in class I'm getting the attributes like

I have written a client to consume this web service and when I try to trigger the request, I'm getting following SOAP envelope request :-

In my client I have not mapped these attributes so it is always going to be empty in SOAP request. I do not want to modify the WSDL (means removing these elements from WSDL file) to exclude these nillable elements from SOAP envelope request. My requirement is I do not want these nillable elements in my SOAP envelope request at all. These elements can appear in SOAP envelope request if there is a data otherwise not (assume I have done the mapping in client side).

I understand that if I remove these annotations completely (@XmlElement(nillable = true)) or make the annotations like @XmlElement in JAXB classes then it will not appear in SOAP envelope request but modifying so many JAXB classes manually is a difficult task for me.

Is there any way I can configure it in POM.xml file so that at the time of generating the JAXB classes using wsdl2java the annotations does not appear in JAXB classes or some other optimum way to prevent it.

Chunk of POM.xml:-

Thank you
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic