BV Commerce Forum
»
BV Commerce Support
»
General Support
»
WebMethod Catalog_InternalProduct_FindByBvin returns multiple copies of AdditionalImages and Reviews
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
This is a fairly serious problem for me. If a product has additional images and product variations, then each call to Catalog_InternalProduct_FindByBvin for any one of the variations increases the number additional images (and reviews) that are returned. To give you an idea of how this grows I have a Shipper customer with 81 pending shipments. One of the popular items has 10 additional images. The first time I call FindByBvin for one particular variation it returns 30 images (3 x the normal amount). The next time I call FindByBvin for the same variation it returns 1350 images. Eventually the web request blows up because it is too big. To recreate: <OL> * Create a new product and attach a couple of addtional images. * Create at least two variations. * Place a few orders with one or both variations. * Run the attached program and note that the additional image count grows. </OL> Note that the program also calls Order_FindByBvin. It's not clear to me if this is interactiving with InternalProduct_FindByBvin to create the problem. The problem seems to be in the product cache, but I'm not sure. File Attachment(s): CheckBvc5WebServices.zip (302kb) downloaded 2 time(s).You cannot view/download attachments. Try to login or register. |
|
|
|
|
Rank: Member
Joined: 3/1/2006(UTC) Posts: 1,142
|
You've really got yourself a good one here Andy. It appears that during the rehydrating of the order object after passing it back from the web services in the call to GetGroups.
I'm doing a bit more research, but for now this appears to be a fairly easy (and hacky) workaround... until we can get it fixed, this is the best I have for you.
orderHeavy.AssociatedProducts = New bvc5.Product() {} For Each item As bvc5.LineItem In orderHeavy.Items item.AssociatedProduct = Nothing Next
groups = GetGroups(orderHeavy) |
Justin Etheredge Senior Software Engineer BVSoftware |
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
Hey Justin,
Thank you for the workaround. You are right that the problems are in the rehydration. I did a bit more research and found some more info that might help.
There are two problems:
1. AdditionalImages, Reviews, (and probably any other Product and InternalProduct property that relies on GetApplicableProduct) are sometimes assigned to the wrong instance (i.e. to a child instead of the parent).
Cause: The ParentId is being deserialized after the property that relies on GetApplicableProduct. So GetApplicableProduct returns the instance (Me) instead of the parent.
Resolution: You could add the <XmlAttribute()> attribute to the ParentId property. This will force the ParentID to be an attribute of the Product or InternalProduct XML element which is processed before any other property that relies on GetApplicableProduct.
Workaround: I can't think of a good workaround. I'm crossing my fingers that this does not have any bad side affects.
2. The number of AdditionalImages and Reviews increases each time an Order instance with line items is sent to any web method.
Cause: Collections are represented as ArrayOfXXX in the wsdl. The generated deserializer simply adds the images to the internal collection (there is no logic in the deserializer to determine if the image or review already exists in the collection). A full Order instance (such as the one returned by Orders_Order_FindByBvin) includes the line items which include the associated product (related products with the same images may also appear in the list of AssociatedProducts). The deserializer will add all the AddditionalImages and Reviews it finds to the collections...*every time the product appears in an order x every time the order is sent to a web method*. That turns into a lot of images and reviews.
Resolution: As a short term fix you could add the <XmlIgnore()> attribute to AdditionalImages and Reviews in both Product and InternalProduct. A longer term fix might be to change the type of AdditionalImages to a a custom type that implements ISerializer. Then you can control which images are deserialized. The same applies to Reviews.
Workaround: Remove the AdditionalImages and Reviews from the Order instance on the web service client before the order is sent to the web method. |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.