在 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);
}

更新於: 2020-02-18

165 次瀏覽

開啟您的職業生涯

完成課程獲得認證

開始
廣告
© . All rights reserved.