-5
我有這個JSON數據,我想使用httpurl連接發佈。使用HttpUrlConnection POST joson數據
POST http://example.com/2_1/payment/tel%3A%2B919825010000/transactions/amount HTTP/1.1
Accept: application/json
Content-Type: application/json
X-Forwarded-For: 129.78.138.66, 129.78.64.103
Authorization: Basic<base64 encoded application credentials>
{
"amountTransaction":
{
"clientCorrelator": "54321",
"endUserId": "tel:+919825010000",
"paymentAmount":
{
"chargingInformation":
{
"code": "WGAME_0010_Ind00001111",
"description": ["Alien Invaders Game"]
},
"chargingMetaData" :
{
"onBehalfOf" : "Example Games Inc",
"purchaseCategoryCode" : "Game",
"channel" : "SMS",
"taxAmount" : 0
}
},
"referenceCode": "REF-12345",
"transactionOperationStatus": "Charged"
}
}
}
如何使用Httpurlconnection使所有這些數據的POST請求。?
您是否將JSON對象添加爲標題字段? – erad 2014-10-06 19:18:11