Querying Commerce Server with Commerce Servers' BizTalk Adapters
I am working on a large project where we need to query Commerce Server to create data feeds to send to such sites as MSN Shopping, Yahoo Shopping, PriceGrabber, etc. When we create these data feeds we need to query for every item in the catalog.
There are a couple of blogs out there with examples of querying for a specific item but in this case I needed to get every single item. One of the things that was not clear to me was if I was supposed to use the field name defined in Commerce Server or if I was supposed to use the column name that I found in the database.
Well, it turned out that I was supposed to use the column name of the database that I wanted to search on.
We had an Inventory catalog and I found that all of the current data had a the value of 1 in the status column. So, in my Orchestration I created a message based on the InventoryQuery schema (msgInventoryQuery )and created the message in a ConstructMessage shape using the following xml in the MessageAssignment shape.
msgInvXmlDoc=new System.Xml.XmlDocument();
msgInvXmlDoc.LoadXml("<CommerceServerInventoryQuery InventoryCatalog='Default' SearchClause='Status=\"1\"'/>");
msgInventoryQuery = msgInvXmlDoc;
For the catalog query I created a message using the CatalogQuery schema and created the following message
msgCatXmlDoc=new System.Xml.XmlDocument();
msgCatXmlDoc.LoadXml("<CommerceServerCatalogQuery ProductCatalog='' SearchClause='DefinitionName =\"ProductGroup\" or DefinitionName =\"ProductItem\"'/>");
msgCatalogQuery = msgCatXmlDoc;
In this orchestration I had 4 queries that I was doing against Commerce Server and needed to receive them in whatever order they came back. I utilized a parallel shape with the receive shape connected to a request / response port. Then I used a Solicit-Response send port for the physical send port utilizing the Catalog and Inventory Commerce Server adapters.
After deployment and binding I am now able to query Commerce Server and receive the entire contents of the catalog.
Comments
- Anonymous
June 16, 2009
PingBack from http://fixmycrediteasily.info/story.php?id=15985