I am trying to create xml data using [http://simple.sourceforge.net/][1] in my android app, but the response is not in the order which I want. Kindly help. Does anybody know about this? Can you point me to references that support one argument or the other?
@Root(name = "soapenv:Envelope")
@NamespaceList({@Namespace(reference = "http://schemas.xmlsoap.org/soap/envelope/", prefix = "soapenv")})
public class CreditTransactionEnvelope {
@Element(name = "soapenv:Body")
public CreditTransactionBody creditTransactionBody;
public static class CreditTransactionBody {
@Element(name = "v1:SendTranRequest")
public CreditTransactionRequest creditTransactionRequest;
@Root
@NamespaceList({@Namespace(reference = "http://postilion/realtime/merchantframework/xsd/v1/", prefix = "v1")})
public static class CreditTransactionRequest implements Serializable{
private static final long serialVersionUID = -6866019353714061968L;
@Element(required = true, name = "v1:merc")
public Merchant merchant;
@Element(name = "v1:tranCode", required = true)
public int tranCode;
@Element(required = true, name = "v1:card")
public Card card;
@Element(name = "v1:reqAmt", required = true)
public int reqAmt;
public static class Merchant {
/* Make sure id of merchant must be 15 digit*/
@Element(name = "v1:id", required = true)
public String id;
/* Make sure regkey of merchant must be 16 digit*/
@Element(name = "v1:regKey", required = true)
public String regKey;
@Element(name = "v1:inType", required = true)
public int type;
/* Product Type: This is the product type for this
particular transaction.
Valid Values: 5 = Credit/Debit Card (Default)
*/
/* This Field is optional*/
@Element(name = "v1:prodType", required = false)
public String productType;
}
public static class Card {
@Element(name = "v1:pan", required = true)
public String pan;
@Element(name = "v1:xprDt", required = true)
public String expiryDate;
@Element(name = "v1:sec", required = false)
public String sec;
@Element(name = "v1:trk1", required = false)
public String trk1;
@Element(name = "v1:trk2", required = false)
public String trk2;
}
}
}
The output produced from above code is below, But i want merc tag at first. OutPut:
<v1:card>
<v1:pan>xxx</v1:pan>
<v1:xprDt>1601</v1:xprDt>
</v1:card>
<v1:merc>
<v1:id>xxx</v1:id>
<v1:regKey>xxx</v1:regKey>
<v1:inType>1</v1:inType>
</v1:merc>
<v1:tranCode>0</v1:tranCode>
<v1:reqAmt>1</v1:reqAmt>
</v1:SendTranRequest>
</soapenv:Body>
</soapenv:Envelope>
[1]: http://simple.sourceforge.net/
0 comments:
Post a Comment