0

I would need to set an attribute value in the WSDL for a JAX-WS WebService. I found that this can be done using the @XmlAttribute annotation for a "public static final" field of a complex type, but how do I actually pass the value from my class to the WSDL? For example, I have a class that is used as an argument for a method:

@XmlType(name = "argument")
public class Argument {

    @XmlAttribute
    public static final int fixer = 7;

}

This would create the following WSDL:

<xs:attribute name="fixer" type="xs:int" use="required"/>

But what I need is:

<xs:attribute name="fixer" type="xs:int" use="required" fixed=7/>

How to accomplish this using JAX-WS annotation?

Any help would be appreciated!

EDIT: added 'final' modifier

milin
  • 414
  • 4
  • 14
  • Though you say the attribute is *final* in your question, the code shows a *non-final* attribute. Are you sure you have a *final* attribute in your code? –  Sep 14 '14 at 23:05
  • You are correct - it is final, I fiddled with the code and must have copied the wrong version. – milin Sep 15 '14 at 08:03
  • I managed to find (somewhere) that this is no longer allowed - adding fixed values to WSDLs. Can someone at least confirm this? – milin Sep 30 '14 at 18:28

0 Answers0