在 SAP ABAP 中出現未經授權的異常
為修復該問題,您需要將 try/catch 響應新增到程式碼中。當您不包含授權標頭時,會引發伺服器的 401 錯誤。
try {
CatalogService.CatalogChangeClient service =
new CatalogService.CatalogChangeClient();
service.ClientCredentials.UserName.UserName = "username";
service.ClientCredentials.UserName.Password = "password";
service.ClientCredentials.SupportInteractive = true;
ProductUpdate[] products = new ProductUpdate[1];
products[0] = new ProductUpdate();
products[0].ProductCode = "00001";
products[0].ProductDescription = "TestProduct";
string result = service.UpdateProducts(products);
} catch (Exception exception) {
Console.WriteLine(exception.Message);
}
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP