Developer forum

Forum » Integration » Endpoint Provider error when casting source to IODataBaseProvider

Endpoint Provider error when casting source to IODataBaseProvider

Mateusz Struzik
Reply

Hi 

I am encountering an error/exception while attempting to export orders from DW 9 (9.17.9) to BC. The source provider is OrderProvider and the destination provider is EndpointProvider.

The exception is as follows:

System.InvalidCastException: Unable to cast an object of type 'Dynamicweb.DataIntegration.Providers.OrderProvider.OrderProvider' to type 'Dynamicweb.DataIntegration.Integration.Interfaces.IODataBaseProvider' at Dynamicweb.DataIntegration.Providers.EndpointProvider.EndpointProvider.RunJob(Job job).

I am curious about what might be causing this issue. I am using the Order provider as a source, and it appears that the Endpoint provider is attempting, but failing, to cast it to IODataBaseProvider.

Is it prohibited to use the Order provider with the Endpoint provider, or is there another underlying issue?

 

Mateusz 


Replies

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Mateusz,

I am not sure why you encounter that exception, do you have a custom Endpoint Provider in your project or is it the standard one from the 9.17.9?

We still have the Endpoint provider on a "beta" version(version 0.2.33) in 9.17.9 and that is becuse we back in version 9.14 changed the OData Provider alot so it was able to work as a source or destination provider (with most if not all the logic that the Endpoint Provider has), so maybe you should try and use the OData Provider as destination instead, and see if this could solve your issue?

BR

Matthias Sort

 
Mateusz Struzik
Reply

Hi Matthias 

Yes i switched to OData provider but first it seems is not work for Odata: expand method and second i was wondering what migh casue the issue. 

And we are using standard one for 9.17.9. 

sample for expand:

/salesOrders?$expand=salesOrderLines

Regards 

Mateusz 

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Mateusz,

Yeah we have not implemented the nested logic into Dynamicweb yet, the way you can solve that problem (you need the order id from your external system) is by doing something that is called "response mappings" DW9 Documentation and forum post about the Order Provider as source and OData Provider as destination (I know this is DW10, but the principle is the same for DW9)

Hope this can help you :)

BR

Matthias Sort

 
Mateusz Struzik
Reply

Hi Matthias

Thanks for quick response. SO the flow will be: 1. export order from DW to external system -> 2. based on response update orders table and order lines table using external order id -> 3. make antoher job where we have external order id and export order  lines to it ? 

Regards 

Mateusz 

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply
This post has been marked as an answer

Hi Mateusz,

You can do everything in the same job all you have to do is have a table mapping from EcomOrders to SalesOrders (add a response mapping to that tablemapping, where you save the external orderid to the EcomOrders.IntegrationOrderId column), then add a second table mapping from EcomOrderLines to SalesOrderLines, as you have access to all EcomOrders properties on EcomOrderLines.

BR

Matthias Sort

Votes for this answer: 1
 
Mateusz Struzik
Reply

Hi 

Okey it make sense. I need to test this solution. 

So for now thansk for your help 

Regards

Mateusz

 

You must be logged in to post in the forum