uCommerce API webservice to integrate with back office system
Currently we are trying to get uCommerce integrated with a back office system. I read that there is a uConnector but thats only for the paid version?
So we decided to write our own webservice to export/import orders. Getting the orders returned in a list is quite easy. But returning them as webservice seems a little bit harder.
I get the following error when trying to serialize the PurchaseOrder object
Cannot serialize member UCommerce.EntitiesV2.Customer.Addresses of type System.Collections.Generic.IList`1[[UCommerce.EntitiesV2.Address, UCommerce, Version=10.0.0, Culture=neutral, PublicKeyToken=null]] because it is an interface.
Which is not a suprise since some of the classes in the model contains ILists/ICollections/IEnumerable.
We could ofcourse write our own wrapper to wrap the PurchaseOrder object, but I was wondering if someone had the same problem. And if so, how did you fix it? Or maybe I'm looking in the wrong direction and is there an easy solution.
You're correct that uConnector will be a paid add-on to the free version.
In the meantime you could take a look at the built-in XML serialization we've got. We're outputting XML for the XSLT API, which might be useful in this instance as well. You can basically grab and order and have the represented as the same XML available to the XSLT API like this:
var renderer = PurchaseOrderRenderer.Create(); XPathNodeIterator iterator = renderer.RenderDocument(myPurchaseOrder);
The objects produced by the LINQ API are not suited for transmission beyond the app boundary as they're database conncted.
As you mention creating a different type with the same properties is another way to go, but the object aggregates do get quite big so you might want to look at create simplified versions with just the information you need or looking at a tool like AutoMapper, which will map similar objects automatically.
uCommerce API webservice to integrate with back office system
Currently we are trying to get uCommerce integrated with a back office system.
I read that there is a uConnector but thats only for the paid version?
So we decided to write our own webservice to export/import orders.
Getting the orders returned in a list is quite easy. But returning them as webservice seems a little bit harder.
I get the following error when trying to serialize the PurchaseOrder object
Which is not a suprise since some of the classes in the model contains ILists/ICollections/IEnumerable.
We could ofcourse write our own wrapper to wrap the PurchaseOrder object, but I was wondering if someone had the same problem. And if so, how did you fix it? Or maybe I'm looking in the wrong direction and is there an easy solution.
Hi Sander,
You're correct that uConnector will be a paid add-on to the free version.
In the meantime you could take a look at the built-in XML serialization we've got. We're outputting XML for the XSLT API, which might be useful in this instance as well. You can basically grab and order and have the represented as the same XML available to the XSLT API like this:
The objects produced by the LINQ API are not suited for transmission beyond the app boundary as they're database conncted.
As you mention creating a different type with the same properties is another way to go, but the object aggregates do get quite big so you might want to look at create simplified versions with just the information you need or looking at a tool like AutoMapper, which will map similar objects automatically.
Hope this helps.
is working on a reply...