2017-08-16 34 views
0

我們剛剛將我們的Acumatica實例升級到版本6.10.0680。我用的是我們以前的實例(V 2489年5月30日)該合約基於API使用此代碼登錄到API和創建銷售訂單:Acumatica API登錄未經授權升級到6.1

using (DefaultSoapClient client = new DefaultSoapClient(binding, address)) 
{ 
    try { 
     //Login to Acumatica API 
     await client.LoginAsync(_acumaticaUid, _acumaticaPwd, _acumaticaCompany, null, null); 

     //Create a sales order with the specified values 
     SalesOrder newOrder = (SalesOrder)await client.PutAsync(orderToBeCreated); 

     client.Logout(); 

     return newOrder; 
    } 
    catch (Exception e) 
    { 
     //order addition to Acumatica failed, update the order status in Woo Commerce 
     client.Logout(); 
     Console.WriteLine("Acumatica could not add specified entity: " + e); 

     return null; 
    } 
} 

URL的客戶端地址PARAM:「https://mysandbox.acumatica.com/MyCompany/entity/Default/5.30.001

上面的代碼完美地適用於我以前使用的版本,但是現在在使用v6.1代碼時,我在client.LoginAsync()方法中獲得未經授權的401響應。以下是錯誤響應:

HTTP請求未經授權,客戶端身份驗證方案 '匿名'。從服務器收到的驗證頭是 '基本'。

我認爲升級版本的構建是向後兼容,所以不應該這仍然工作?我是否需要更改某些內容才能在v6.1上進行此項工作?

Acumatica Documentation

您可以使用Acumatica ERP的未來版本相同的系統的端點。例如,如果您使用版本5.30.001 和合同版本1的系統端點訪問Acumatica ERP 5.3,則可以使用相同的端點訪問未來版本的Acumatica ERP。

P.S.最終,我們將升級到現在可用的REST API,但這需要在此期間運行。

+0

您是否已從HTTP到HTTPS?這看起來像是一個'綁定'錯誤。您也可以嘗試重新生成服務參考。 –

+0

我已經能夠在v5.3上使用http和https這個服務引用。我試圖重新生成v6.1 Acumatica實例的url服務參考,但我仍然收到相同的401錯誤。 –

+0

當你的瀏覽器導航時,你會看到什麼: https://mysandbox.acumatica.com/MyCompany/entity/Default/5.30.001 –

回答

1

你的代碼很好,.Net中的WebService API和引用是浮躁的。

當遇到連接問題,有時需要更新或從頭開始重建參考:

enter image description here

在同一個菜單,你可以在「配置服務引用」的WSDL地址: enter image description here

確保可以從瀏覽器訪問WSDL URL: enter image description here