如何使用改造简单的xml转换器创建请求?

时间:2017-01-13 05:39:29

标签: android xml retrofit retrofit2 okhttp3

我想使用改造简单的xml转换器创建xml soap请求。我正在使用改造2.1。我试过但是标题正文的顺序发生了变化。请看下面的输出。 任何帮助都将非常感激。 感谢。

Github Code Link

预期输出

<x:Envelope
xmlns:x="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gmt="http://soap.sforce.com/schemas/class/Webservice">
<x:Header>
    <gmt:SessionHeader>
        <gmt:sessionId>?</gmt:sessionId>
    </gmt:SessionHeader>
    <gmt:CallOptions>
        <gmt:client>?</gmt:client>
    </gmt:CallOptions>
    <gmt:DebuggingHeader>
        <gmt:categories>
            <gmt:category>Db</gmt:category>
            <gmt:level>None</gmt:level>
        </gmt:categories>
        <gmt:debugLevel>None</gmt:debugLevel>
    </gmt:DebuggingHeader>
    <gmt:AllowFieldTruncationHeader>
        <gmt:allowFieldTruncation>false</gmt:allowFieldTruncation>
    </gmt:AllowFieldTruncationHeader>
</x:Header>
<x:Body>
    <gmt:user_authenticate>
        <gmt:username>test@test.com</gmt:username>
        <gmt:password>test</gmt:password>
    </gmt:user_authenticate>
</x:Body>

实际输出

<x:Envelope
xmlns:x="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gmt="http://soap.sforce.com/schemas/class/Webservice">
<x:Body>
    <gmt:user_authenticate>
        <gmt:password>test</gmt:password>
        <gmt:username>test@test.com</gmt:username>
    </gmt:user_authenticate>
</x:Body>
<x:Header>
    <gmt:AllowFieldTruncationHeader>
        <gmt:allowFieldTruncation>false</gmt:allowFieldTruncation>
    </gmt:AllowFieldTruncationHeader>
    <gmt:CallOptions>
        <gmt:client>?</gmt:client>
    </gmt:CallOptions>
    <gmt:DebuggingHeader>
        <gmt:debugLevel>None</gmt:debugLevel>
        <gmt:categories>
            <gmt:category>Db</gmt:category>
            <gmt:level>None</gmt:level>
        </gmt:categories>
    </gmt:DebuggingHeader>
    <gmt:SessionHeader>
        <gmt:sessionId>?</gmt:sessionId>
    </gmt:SessionHeader>
</x:Header>

1 个答案:

答案 0 :(得分:0)

您应该可以使用以下内容

@Order(elements = {"Header", "Body"}) 
相关问题