Carlo
Carlo

Reputation: 1714

How to change package-info.java content

Simple problem, but I've banged my head all day long. JAX-WS webservice, generated from third party WSDL. The content is something like this:

@javax.xml.bind.annotation.XmlSchema(namespace = "http://foo.it/bar",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package it.foo.bar.webservice.generated;

The webservice works, the output produces is like the following:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
 <S:Body>
   <response xmlns="it.foo.bar.bean">
     <result>

Problem is the client who's using the web service, needs the response like this:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
 <S:Body>
   <ns:response xmlns:ns="it.foo.bar.bean">
     <ns:result>

If I manually add to the package-info the XmlNs annotation:

@javax.xml.bind.annotation.XmlSchema(namespace = "http://foo.it/bar", xmlns = {
@javax.xml.bind.annotation.XmlNs(namespaceURI = "it.foo.bar.bean", prefix = "sms")
}, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package it.foo.bar.webservice.generated;

The response is generated as expected. Is there a way to achieve the same result using only wsimport, or some jaxb binding or whatever? I'm pretty sure there's a better way than overwriting the package-info.java every time.

Upvotes: 3

Views: 6591

Answers (1)

Puce
Puce

Reputation: 38142

This is a known issue: http://java.net/jira/browse/JAXB-818

Feel free to vote, comment and/or provide a fix.

Upvotes: 2

Related Questions