0

I am doing java-first web service development. I want to add description to @XmlElement for a field so that the generated WSDL will contain documentation for the field.

It seems you can't do this with @XmlElement. Don't know why Oracle doesn't support it.

If I choose another binding other than JAXB, can I do it?

Jian Chen
  • 586
  • 7
  • 20

1 Answers1

1

It is not possible to use a JAXB annotation so the documentation details will be included in the generated schema (see this)

You can use CXF custom annotations, but are only available for ports and operations

@WebService
@WSDLDocumentationCollection(
    {
        @WSDLDocumentation("My portType documentation"),
        @WSDLDocumentation(value = "My top level documentation",
                           placement = WSDLDocumentation.Placement.TOP),
        @WSDLDocumentation(value = "My binding doc",
                           placement = WSDLDocumentation.Placement.BINDING)
    }
)
public interface MyService {

    @WSDLDocumentation("The docs for echoString")
    String echoString(String s);

}
Community
  • 1
  • 1
pedrofb
  • 37,271
  • 5
  • 94
  • 142
  • Cool. Btw, is there any JIRA issue that tracks the requirement of CXF's another documentation annotation for WebParams and XmlElements ? – Jian Chen Aug 01 '16 at 14:51
  • 1
    There are some issues reported that you can see searching by free text `@WSDLDocumentation`. https://issues.apache.org/jira/browse/CXF-6291?jql=text%20~%20%22%40WSDLDocumentation%22 I think CXF-6291 is similar to your request. https://issues.apache.org/jira/browse/CXF-6291 – pedrofb Aug 01 '16 at 19:14