使用Retrofit 2和Simple XML Converter无法获得SOAP信封主题,发送者,多维数据集

时间:2018-12-08 04:49:37

标签: xml retrofit converters

我正在使用Retrofit 2.2.0和Retrofit SimpleXML Converter 2.2.0。我使用addConverterFactory方法将SimpleXmlConverter添加到Retrofit实例中。

问题是当我收到响应时,它收到以下错误

java.lang.RuntimeException:org.simpleframework.xml.core.ElementException:元素“ subject”在类ResponseEnvelope的第1行不匹配

我应该得到这样的XML响应:

<hismos:Envelope xmlns:hismos="http://www.x3schools.com/xml/2002-08-01" xmlns="http://www.x3schools.com">
<hismos:subject>Reference rates</hismos:subject>
<hismos:Sender>
<hismos:name>Time to Stack Address</hismos:name>
</hismos:Sender>
<Cube>
    <Cube time="2018-12-07">
        <Cube country="USA" city="CA"/>
    </Cube>
</Cube>

@Root(name = "Envelope")@NamespaceList({
    @Namespace(prefix = "gesmes", reference = "http://www.gesmes.org/xml/2002-08-01"),
    @Namespace(reference = "http://www.ecb.int/vocabulary/2002-08-01/eurofxref")})final class ResponseEnvelope {

@Element
@Namespace(prefix = "gesmes")
private String subject;}

0 个答案:

没有答案