• Post Reply Bookmark Topic Watch Topic
  • New Topic

More fun with JAXB, trying to implement Oasis WSN top down - errors genned  RSS feed

Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all (and hopefully Ivan):

I'm using wsconsume to generate artifacts for a JBoss 4.2 JAX-WS service (this is mentioned in one other post where I encountered JAXB errors)

There are JAXB errors related to the WSN Notification spec. The issue seems to be that some types are defined as QName with no parms and the generated code can't handle these.
It can't instantiate QName. If I modify the generated code to make it a String, it loads.

Here's a sample of what wsconsume gens:

protected List<QName> messageTypes;

public List<QName> getMessageTypes() {
if (messageTypes == null) {
messageTypes = new ArrayList<QName>();
return this.messageTypes;

the new ArrayList<QName>() is the problem - it causes a JAXB exception - no default constructor

And here is what AXIS2 gens:

public java.util.List getMessageTypes()

synchronized (monitor())



org.apache.xmlbeans.SimpleValue target = null;

target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(MESSAGETYPES$6);

if (target == null)


return null;


private static final javax.xml.namespace.QName MESSAGETYPES$6 = new javax.xml.namespace.QName("", "messageTypes");

So you can see AXIS2 creates the List with a QName("", "messageTypes")

and wsconsume (JAXB) does not

JAXB err

# java.lang.IllegalStateException: Cannot build JAXB context
# at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder.createJAXBContext(JAXWSMetaDataBuilder.java:925)
# @XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
# this problem is related to the following location:
# at protected java.util.List org.oasis_open.docs.wsn.t_1.TopicType.messageTypes

So the problem is that the generated wsconsume stubs define messageTypes as List<QName>. If I change it to List<String> I get past the problem.
But obviously, this is not good. I want to implement the Oasis WSN spec and generate working stubs and go from there.

From the spec for this (Oasis WSN spec):

<xsd:attribute name="messageTypes">
<xsd:list itemType="xsd:QName"/>

Do I need to create JAXB binding files to somehow change the type of xsd:QName to something else? e.g. QName("", "messageTypes")
(I can pass binding files into the wsconsume process)
How can I do this?
Can I get a sample?

any help greatly appreciated.


Ranch Hand
Posts: 2198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide a link to the complete XML schema containing the data structure you have problems with?
I do not use Axis, but I am regardless curious to see what JAXB makes out of that schema.
I come to think of using a JAXB mapping file to map QName to String, but I will take a look and let you know.
Best wishes!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!