Я пытаюсь использовать сторонние мыльные API в веб-интерфейсе asp.net.Он работает локально, но при запуске в Azure получает сообщение об исключении «Заголовок HTTP Content-Type необходим для обмена сообщениями SOAP, и ни один из них не был найден».
Вот код контроллера значений asp.net api.Сбой при вызове метода signin ().
ValuesController.cs
[HttpPost]
//public VoucherRedeemtionData RedeemVoucher(string voucherCode, float cartValue)
public async Task<VoucherRedeemtionData> RedeemVoucher([FromBody] CouponData coupon)
{
float transactionAmount = 0;
string WorkKey = await SignIn();
string voucherCode = coupon.voucherCode;
float cartValue = coupon.cartValue;
ValidationData couponValidationData = await ValidateVoucher(voucherCode);
if (couponValidationData.message == "Success")
{
float couponBalance = float.Parse(couponValidationData.balance);
float cartValueInPaise = cartValue * 100;
if (cartValueInPaise < couponBalance)
{
transactionAmount = cartValueInPaise;
}
else
{
transactionAmount = couponBalance;
}
}
else
{
VoucherRedeemtionData voucherRedemptionData = new VoucherRedeemtionData
{
transactionAmount = 0,
message = couponValidationData.message,
voucherBalance = couponValidationData.balance
};
return voucherRedemptionData;
}
VoucherRedeemtionData voucherRedeemtionData = await VoucherRedemption(voucherCode, transactionAmount);
await SignOut();
return voucherRedeemtionData;
}
ValuesController.cs
private async Task<string> SignIn()
{
string ManageType = "101";
string TerminalSSN = CalculateTerminalSSN();
string ManageTerminalDateTime = CalculateManageTerminalDateTime();
string ChecksumInput = Channel + "=" + MerchantCode + "=" + ProgramCode + "=" + ShopCode + "=" + TerminalCode + "=" + TerminalSSN + "=" + ManageTerminalDateTime + "=" + ManageType + "=" + MerchantSecurityKey;
string Checksum = CalculateManageTerminalChecksum(ChecksumInput);
POSProxyServiceReference2.ManageTerminalRequestIn request = new POSProxyServiceReference2.ManageTerminalRequestIn
{
Channel = Channel,
Checksum = Checksum,
ManageTerminalDateTime = ManageTerminalDateTime,
ManageType = ManageType,
MerchantCode = MerchantCode,
ProgramCode = ProgramCode,
ShopCode = "",
TerminalCode = "",
TerminalSSN = TerminalSSN
};
POSProxyServiceReference2.POSProxyClient pOSProxyClient = new POSProxyServiceReference2.POSProxyClient();
pOSProxyClient.InnerChannel.OperationTimeout = new TimeSpan(0, 10, 0);
POSProxyServiceReference2.ManageTerminalResponseOut response = await pOSProxyClient.ManageTerminalAsync(request);
if (response.Message == "Success")
{
WorkKey = response.WorkKey;
}
pOSProxyClient.Close();
return response.WorkKey;
}
Webapicongig.cs
config.Routes.MapHttpRoute(
name: "RedeemVoucher",
routeTemplate: "api/RedeemVoucher/{coupon}",
defaults: new { controller = "Values", coupon = RouteParameter.Optional }
);