【发布时间】:2014-10-06 19:04:06
【问题描述】:
我有想要使用 httpurl 连接发布的 JSON 数据。
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 对象添加为标头字段?
标签: java android json post httpurlconnection