I'm using JAX-RS to create a WADL file. My problem is that the namespaces in the generated WADl file are not matching. The namespace defined in the grammar section should be the same as in the resources section but the prefix is a different one.
I hope someone can help me find out what I'm doing wrong.
Here is my code:
@POST
@Path("/testpfad")
@Produces("application/json")
@Consumes("application/json")
@Descriptions({ @Description(value = "Testbeschreibung", target = DocTarget.METHOD) })
public TestErgebnis testMethod(@NotNull TestAnfrage anfrage){
return null;
}
@XmlRootElement
@Doc(value = "Beschreibung - TestAnfrage")
public class TestAnfrage {
@Doc("Beschreibung")
private String test;
public String getTest() {
return test;
}
public void setTest(final String test) {
this.test = test;
}
}
@XmlRootElement
@Doc(value = "Beschreibung - TestErgebnis")
public class TestErgebnis {
@Doc("Beschreibung")
private boolean test;
public boolean isTest() {
return test;
}
public void setTest(final boolean test) {
this.test = test;
}
}
My package-info:
@XmlSchema(
namespace = "http://www.example.org/package",
elementFormDefault = XmlNsForm.QUALIFIED)
package example;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
The generated WADL file:
<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:prefix1="http://www.example.org/package"><grammars><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/package" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.example.org/package">
<xs:element name="testAnfrage" type="tns:testAnfrage"/>
<xs:element name="testErgebnis" type="tns:testErgebnis"/>
<xs:complexType name="testErgebnis">
<xs:sequence>
<xs:element name="test" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testAnfrage">
<xs:sequence>
<xs:element minOccurs="0" name="test" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</grammars>
<resources base="http://localhost:5050/sunrise-online/services/oas/antrag">
<resource path="/">
<resource path="testpfad">
<method name="POST">
<doc>Testbeschreibung</doc>
<request>
<representation mediaType="application/json" element="prefix1:testAnfrage">
</representation>
</request>
<response>
<representation mediaType="application/json" element="prefix1:testErgebnis">
</representation>
</response>
</method>
</resource>
</resource>
</resources>
And I would have expected something like that:
<xs:element name="testAnfrage" type="prefix1:testAnfrage"/>
<xs:element name="testErgebnis" type="prefix1:testErgebnis"/>
or that:
<request>
<representation mediaType="application/json" element="tns:testAnfrage">
</representation>
</request>
<response>
<representation mediaType="application/json" element="tns:testErgebnis">
</representation>
</response>