生成用于 Retrofit 在 Android 中的 XML 响应的 Pojo 类。

huangapple 未分类评论45阅读模式
英文:

Making Pojo Class of XML response for Retrofit Android

问题

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:cardtransactionResponse xmlns:ns2="http://webservices.serfinsa.sysdots.com/">
            <return>{"cliente_trans_terminalid":"00299997",
                     "cliente_trans_trantime":"083307",
                     "cliente_trans_referencia":"020708000010",
                     "cliente_trans_networkid":"024",
                     "cliente_trans_autoriza":"016998",
                     "cliente_trans_respuesta":"00",
                     "cliente_trans_trandate":"0725",
                     "cliente_trans_tipomensaje":"000000",
                     "cliente_trans_auditno":"000010",
                     "cliente_trans_monto":"000000002300"}</return>
        </ns2:cardtransactionResponse>
    </S:Body>
</S:Envelope>
英文:

I have been developing android applications for the last 2 years but today I am stuck on a strange issue. I am calling an API from my android application using retrofit 2.1.0 and its response is in XML. This is is the first time, I am having such an issue but I don't how to make POJO class of XML. I did a lot of R&D but I couldn't understand their logic. This is the response of API. Can u guide me to make POJO class of this response so that I can use it in my retrofit class

    &lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39;?&gt;
    &lt;S:Envelope xmlns:S=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
        &lt;S:Body&gt;
            &lt;ns2:cardtransactionResponse xmlns:ns2=&quot;http://webservices.serfinsa.sysdots.com/&quot;&gt;
                &lt;return&gt;{&quot;cliente_trans_terminalid&quot;:&quot;00299997&quot;,
                         &quot;cliente_trans_trantime&quot;:&quot;083307&quot;,
                         &quot;cliente_trans_referencia&quot;:&quot;020708000010&quot;,
                         &quot;cliente_trans_networkid&quot;:&quot;024&quot;,
                         &quot;cliente_trans_autoriza&quot;:&quot;016998&quot;,
                         &quot;cliente_trans_respuesta&quot;:&quot;00&quot;,
                         &quot;cliente_trans_trandate&quot;:&quot;0725&quot;,
                         &quot;cliente_trans_tipomensaje&quot;:&quot;000000&quot;,
                         &quot;cliente_trans_auditno&quot;:&quot;000010&quot;,
                         &quot;cliente_trans_monto&quot;:&quot;000000002300&quot;}&lt;/return&gt;

            &lt;/ns2:cardtransactionResponse&gt;
        &lt;/S:Body&gt;
    &lt;/S:Envelope&gt;

huangapple
  • 本文由 发表于 2020年7月25日 23:45:03
  • 转载请务必保留本文链接:https://java.coder-hub.com/63090315.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定