简体   繁体   中英

Microsoft CommerceServer Web Service searchClause

i'm using microsoft commerce server and I recently learned how to use the xml web service. I need to update some products using the 'updateitems' method.

The SOAP envelope looks like this:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
<UpdateItems xmlns="http://schemas.microsoft.com/CommerceServer/2006/06/CatalogWebService">
  <catalogName>string</catalogName>
  <searchClause>string</searchClause>
  <propertyName>string</propertyName>
  <replacementValue />
  <classTypes>None or CategoryClass or ProductVariantClass or ProductClass or ProductFamilyClass or ProductFamilyForVariantsClass or ProductVariantsForFamilyClass or AllClassTypesClass</classTypes>
  <language>string</language>
</UpdateItems>
</soap:Body>
</soap:Envelope>

My request using nuSoap looks like this:

$client = new nusoap_client($wsdl, TRUE);
$client->setCredentials('', '', 'ntlm');
$client->setUseCurl(true);
$client->useHTTPPersistentConnection();
$client->setCurlOption(CURLOPT_USERPWD, *);

$m = array(
'catalogName' => 'cat',
'propertyName => 'itemdesc',
'replacementValue' => 'somevalue'
);
$resp = ($client->call('UpdateItems', $m));

What I am not understanding is the searchClause. I don't know what any of the table or columns are named and since I am working with sensitive data, and a lot of it, I don't want to test via trial and error. I want to do something like 'ProductID = 159999' in the search clause, but it is not having it.

Couple of points of guidance:

  1. SearchClause properties: The searchclause allows you to build a where clause based on the properties in your _CatalogProducts table inside of your _ProductCatalog database where refers to the name of you catalog (as viewable in Commerce Server Catalog Manager) and refers to the name you gave to you CommerceServer Site

  2. Property Name: This property name you use here would correspond to the classType of the entity you are updating. Click here to learn more about the various classtypes http://msdn.microsoft.com/en-us/library/ee784608(v=cs.20).aspx . To learn what properties are mapped to which entities, you could look in Commerce Server Catalog and Inventory Schema Manager. Here you will find all property definitions, product definitions, category definitions, and catalog definitions.

Example search clause to update the list price of a red product variant of the tennis shoe whose productid is ABC123 and variant id (for the red variant color of the shoe, is ABC123-RED. I'm not familiar with nuSoap, but based on your example above, I think your code wuld look something like. Also, you would need to properly escape the single quotes in the searchClause below

$client = new nusoap_client($wsdl, TRUE);
$client->setCredentials('', '', 'ntlm');
$client->setUseCurl(true);
$client->useHTTPPersistentConnection();
$client->setCurlOption(CURLOPT_USERPWD, *);

$m = array(
'catalogName' => 'YourCatalogName',
'searchClause' => '(ProductId = ''ABC123'' AND VariantId = ''ABC123-RED'')',
'propertyName => 'Description',
'replacementValue' => 'Red is the new color for fall, check out these kicks!'
);
$resp = ($client->call('UpdateItems', $m));

Obviously if you have spaces in the property names, you will want to use [] as delimiters, as in "[My Custom Column]".

The best thing to do is to first familiarize yourself with the SQL database tables where the product catalog is stored and then check out your current data configurations using Commerce Server Catalog and Inventory Manager and Commerce Server Catalog Manager for your current data instances.

You may want to consider that Microsoft, then Cactus, then Ascentium and now Smith who owns the product have said for years that these ASMX based web services are going away, so you may just want to write your own service that consumes the API. I would recommend that for having greater control over the update. If you are more comfortable with SQL, I would recommend diving deeper into the product catalog database I mentioned above, its a very simple structure and very easy to write SSIS or other bulk copy operations for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM