英文:
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
<?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>
专注分享java语言的经验与见解,让所有开发者获益!
评论