JAX-RS WADL не совпадает с префиксами пространства имен - PullRequest
0 голосов
/ 14 сентября 2018

Я использую JAX-RS для создания файла WADL.Моя проблема заключается в том, что пространства имен в сгенерированном файле WADl не совпадают.Пространство имен, определенное в разделе грамматики, должно быть таким же, как и в разделе ресурсов, но префикс другой.

Я надеюсь, что кто-то может помочь мне выяснить, что я делаю неправильно.

Вот мой код:

@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;
    }
}

Информация о моем пакете:

@XmlSchema( 
    namespace = "http://www.example.org/package", 
    elementFormDefault = XmlNsForm.QUALIFIED) 
package example;

import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

Сгенерированный файл WADL:

<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>

ИЯ бы ожидал что-то вроде этого:

<xs:element name="testAnfrage" type="prefix1:testAnfrage"/>
<xs:element name="testErgebnis" type="prefix1:testErgebnis"/>

или что:

 <request>
     <representation mediaType="application/json" element="tns:testAnfrage">
     </representation>
 </request>
 <response>
      <representation mediaType="application/json" element="tns:testErgebnis">
      </representation>
 </response>
...