Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Sander Boele 8 posts 29 karma points
    Dec 08, 2011 @ 15:44
    Sander Boele
    0

    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.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 13, 2011 @ 13:25
    Søren Spelling Lund
    0

    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:

    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.

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft