我使用的是微软商务服务器,最近我学会了如何使用xml服务。我需要使用“updateitem”方法更新一些产品。
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。我不知道表或列的名称是什么,因为我正在处理敏感数据,而且很多都是敏感数据,所以我不想通过反复试验来测试。我想在搜索子句中执行类似'ProductID = 159999‘的操作,但它没有这样做。
发布于 2013-02-23 15:33:14
几个指导点:
示例搜索子句,用于更新其productid为ABC123且变体id为ABC123的网球鞋的红色产品变体的标价(对于鞋子的红色变体颜色,为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));
显然,如果属性名称中有空格,则需要使用[]作为分隔符,如"My Custom Column“中所示。
最好的做法是首先熟悉存储产品目录的SQL数据库表,然后使用Commerce Server catalog和Inventory Manager以及Commerce Server Catalog Manager查看当前数据实例的当前数据配置。
您可能会考虑Microsoft,然后是Cactus,然后是Ascentium,现在是拥有该产品的Smith,他们多年来一直在说,这些基于ASMX的web服务正在消失,所以您可能只想编写自己的使用API的服务。我建议这样做是为了更好地控制更新。如果您对SQL更熟悉,我建议您深入研究我上面提到的产品目录数据库,它是一个非常简单的结构,很容易为其编写SSIS或其他批量复制操作。
https://stackoverflow.com/questions/14844365
复制相似问题