Microsoft CommerceServer Web服务searchClause

时间:2013-02-13 00:19:12

标签: xml web-services soap commerce

我正在使用微软商务服务器,最近我学会了如何使用xml网络服务。我需要使用' updateitems'更新一些产品。方法。

SOAP信封如下所示:

<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>

我使用nuSoap的请求如下:

$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));

我不理解的是searchClause。我不知道任何一个或多个列的名称是什么,因为我正在使用敏感数据,而且很多,我不想通过反复试验来测试。我想做一些像&#39; ProductID = 159999&#39;在搜索条款中,但没有它。

1 个答案:

答案 0 :(得分:0)

几点指导:

  1. SearchClause属性:searchclause允许您根据_ProductCatalog数据库中_CatalogProducts表中的属性构建where子句,其中引用您的目录名称(可在Commerce Server Catalog Manager中查看)并引用您给CommerceServer网站的名称

  2. 属性名称:此处使用的此属性名称将对应于要更新的​​实体的classType。单击此处以了解有关各种类型http://msdn.microsoft.com/en-us/library/ee784608(v=cs.20).aspx的更多信息。要了解哪些属性映射到哪些实体,您可以查看Commerce Server目录和库存架构管理器。您可以在此处找到所有属性定义,产品定义,类别定义和目录定义。

  3. 更新网球鞋的红色产品变体的定价的示例搜索条款,其产品是ABC123和变体id(对于鞋子的红色变体颜色,是ABC123-RED。我不熟悉nuSoap,但根据你上面的例子,我认为你的代码看起来像。还有,你需要正确地逃避下面的searchClause中的单引号

    $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));
    

    显然,如果属性名称中有空格,则需要使用[]作为分隔符,如“[我的自定义列]”中所示。

    最好的做法是首先熟悉存储产品目录的SQL数据库表,然后使用Commerce Server目录和库存管理器以及Commerce Server目录管理器检查当前数据实例的当前数据配置。

    你可能想要考虑微软,然后是仙人掌,然后是Ascentium,现在拥有该产品的史密斯多年来已经说过这些基于ASMX的网络服务正在消失,所以你可能只想编写自己的服务来消费API。我建议更好地控制更新。如果您对SQL更熟悉,我建议您深入了解我上面提到的产品目录数据库,它是一个非常简单的结构,非常容易编写SSIS或其他批量复制操作。