Unable to post an OEOrder, get vague error back

Hello,

I have been working with the Sage staff and currently still do not have a resolution to this issue. Effectively I am making a request through the API to enter an order for a purchased item from the website. Initially I was getting errors I expected like the change of field types and expected data but now I am only getting the following:

{
"error": {
"code": "General",
"message": {
"lang": "en-US",
"value": ""
}
}
}

According to the Sage DPP rep I have been talking with the issue stems from some COM API dying. The logs have the following in them when I make the request:

Timestamp: 2018-11-01 2:30:14 PM
Message: Error-[Tenant:] [Company:] [Module:] [User:] - Sage 300 Web API encountered an error for Url 'IPADDRESS/.../OEOrders'.:
(Inner Exception)
Exception Source: NAME.Advantage.COMSVR.Interop
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: Error HRESULT E_FAIL has been returned from a call to a COM component.
---- Stack Trace ----
NameCOMSVR.NameSvrViewClass.BlkPut(Object& FieldIDs, Object& pValues, Boolean Verify) in NAME.Advantage.COMSVR.Interop.dll
NAME.Advantage.Server.View.BlkPut(FieldValue[] newValues, Boolean verify) in NAME.Advantage.Server.dll
NAME.Advantage.View.BlkPut(Int32[] fieldIDs, Object[] fieldValues, Boolean verifyValues) in NAME.Advantage.dll
Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository.BusinessEntity.BulkPut(Int32[] fieldIDs, Object[] fieldValues, Boolean verifyValues) in Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository.dll,file: BusinessEntity.cs,line: 1084

(Outer Exception)
Exception Source: Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository
Exception Type: Sage.CA.SBS.ERP.Sage300.Common.Exceptions.BusinessException
Exception Message:

I am able to get a customer and update them, but OEOrders always fails, even when using the most simple request to create that I took from the SampleIntegration on Github.

So far nothing has resolved the issue. Any help would be appreciated. We are using Sage 2019 with the latest updates.

I am just adding some info here. All I am currently doing is making a request using Postman to the RESTful api. I can create an order as long as no OrderDetails are in it (as in items and their quantities). The stack trace above is from the trace.log in the WebAPI folder. I genuinely think this is a Sage issue.

  • 0

    I'd recommend going to the VBA forum (it isn't just for VBA/macros).

    https://sagecity.na.sage.com/support_communities/sage_partners/f/sage-300-vba

    We'll need to see your code and, specifically, your error trapping.  The COM interface will throw a general exception and then your AccpacSession object has an error object that will contain the messages from Sage.

  • 0 in reply to Django

    I am using no code here at all other than a request to the Sage Server using Postman. Would you like to see the request body?

  • 0 in reply to VaxxJer

    It won't mean much to me.  You do need to know which are the minimum fields and the order of the fields is important.  You will need to figure out how to get the error messages back from Sage when there is a failure reported by Sage.  If you have access to the following group, they might be able to help you further:

    https://sagecity.na.sage.com/support_communities/sage_partners/f/sage-300-development-partner

  • 0

    I have the same issue did you find out the problem?

  • 0 in reply to Aaron B

    Yes, our issue was that the company did not have a default location set. We had to add the field "DefaultLocation" to the main order body.

  • 0 in reply to Aaron B

    Sorry the field was DefaultLocationCode and you have to put in a valid code as a string.

  • 0

    I have the same issue , I posted the payload below on the webapi 

    {
    "CustomerNumber": "A0118",

    "DefaultLocationCode":"XDE",
    "OrderDescription": "Order Entry",
    "OrderDate": "2020-01-15",
    "OrderDetails": [
    {
    "LineType": "Item",
    "Item": "A1-105/0",
    "Location": "1",
    "QuantityOrdered": 8
    },
    {
    "LineType": "Miscellaneous",
    "MiscellaneousChargesCode": "HC",
    "ExtendedAmount": 20.25
    }
    ]
    }

    and received the response below from swagger 

    {
    "error": {
    "code": "InternalServerError",
    "message": {
    "lang": "en-US",
    "value": "Internal Server Error"

    }
    }
    }

    and  the trace logs shows the below trace . Any ideas from you guys ?

    Timestamp: 11/9/2021 2:57:04 PM
    Message: Error-[Tenant:] [Company:] [Module:] [User:] - Sage 300 Web API encountered an error for Url 'localhost/.../OEOrders'.:
    (Inner Exception)
    Exception Source: ACCPAC.Advantage.COMSVR.Interop
    Exception Type: System.Runtime.InteropServices.COMException
    Exception Message: Error HRESULT E_FAIL has been returned from a call to a COM component.
    ---- Stack Trace ----
    AccpacCOMSVR.AccpacSvrViewClass.BlkPut(Object& FieldIDs, Object& pValues, Boolean Verify) in ACCPAC.Advantage.COMSVR.Interop.dll
    ACCPAC.Advantage.Server.View.BlkPut(FieldValue[] newValues, Boolean verify) in ACCPAC.Advantage.Server.dll
    ACCPAC.Advantage.View.BlkPut(Int32[] fieldIDs, Object[] fieldValues, Boolean verifyValues) in ACCPAC.Advantage.dll
    Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository.BusinessEntity.BulkPut(Int32[] fieldIDs, Object[] fieldValues, Boolean verifyValues) in Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository.dll,file: BusinessEntity.cs,line: 1141

    (Outer Exception)
    Exception Source: Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository
    Exception Type: Sage.CA.SBS.ERP.Sage300.Common.Exceptions.BusinessException
    Exception Message:
    ---- Stack Trace ----
    Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository.BusinessEntity.BulkPut(Int32[] fieldIDs, Object[] fieldValues, Boolean verifyValues) in Sage.CA.SBS.ERP.Sage300.Common.BusinessRepository.dll,file: BusinessEntity.cs,line: 1145
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.BusinessRepository.ViewResourceEntity`1.SetEntityWithModel(TModel model, Boolean setOnlyChangedProperties) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceEntity.cs,line: 0958
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.BusinessRepository.ViewResourceEntity`1.Create(ViewResourceModel model) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceEntity.cs,line: 0474
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.BusinessRepository.ViewResourceEntity`1.CreateDetails(DetailEntity detailEntity, IList detailList) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceEntity.cs,line: 0737
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.BusinessRepository.ViewResourceEntity`1.ApplyToDetailEntities(ViewResourceModel model, Action`2 action) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceEntity.cs,line: 0716
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.BusinessRepository.ViewResourceEntity`1.Create(ViewResourceModel model) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceEntity.cs,line: 0479
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.BusinessRepository.ViewResourceRepository`1.Add(TModel model) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceRepository.cs,line: 0497
    Sage.CA.SBS.ERP.Sage300.Common.WebApi.Controllers.ViewResourceController`1.Post(TModel model) in Sage.CA.SBS.ERP.Sage300.Common.WebApi.dll,file: ViewResourceController.cs,line: 0190
    (Closure , Object , Object[] ) in <In Memory Module>
    System.Web.Http.Controllers.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) in System.Web.Http.dll
    System.Web.Http.Controllers.ActionExecutor.Execute(Object instance, Object[] arguments) in System.Web.Http.dll
    System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) in System.Web.Http.dll
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in mscorlib.dll
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in mscorlib.dll
    System.Web.Http.Controllers.<InvokeActionAsyncCore>d__0.MoveNext() in System.Web.Http.dll
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in mscorlib.dll
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in mscorlib.dll
    System.Web.Http.Filters.<CallOnActionExecutedAsync>d__5.MoveNext() in System.Web.Http.dll
    System.Web.Http.Filters.<CallOnActionExecutedAsync>d__5.MoveNext() in System.Web.Http.dll
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in mscorlib.dll
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in mscorlib.dll
    System.Web.Http.Filters.<ExecuteActionFilterAsyncCore>d__0.MoveNext() in System.Web.Http.dll
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in mscorlib.dll
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in mscorlib.dll
    System.Web.Http.Controllers.<ExecuteAsync>d__2.MoveNext() in System.Web.Http.dll
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in mscorlib.dll
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in mscorlib.dll
    System.Web.Http.Filters.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() in System.Web.Http.dll
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in mscorlib.dll
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in mscorlib.dll
    System.Web.Http.Controllers.<ExecuteAsync>d__0.MoveNext() in System.Web.Http.dll