b2c-webservices
БесплатноБез исполняемых скриптовНе проверенImplement web service integrations in B2C Commerce using LocalServiceRegistry. Use this skill whenever the user needs to call external REST or SOAP APIs from…
от SalesforceCommerceCloud★ 58 звёзд на GitHubОб этом скилле
Web Services Skill
This skill guides you through implementing web service integrations in B2C Commerce using the Service Framework.
Overview
The Service Framework provides a structured way to call external services with:
| Feature | Description |
|---|---|
| Configuration | Service settings managed in Business Manager |
| Rate Limiting | Automatic throttling to protect external systems |
| Circuit Breaker | Automatic failure handling to prevent cascade failures |
| Logging | Communication logging with sensitive data filtering |
| Mocking | Test services without external calls |
Service Types
| Type | Use Case | Protocol |
|---|---|---|
HTTP |
REST APIs, webhooks | HTTP/HTTPS |
HTTPForm |
Form submissions | HTTP/HTTPS with form encoding |
FTP |
File transfers (deprecated) | FTP |
SFTP |
Secure file transfers | SFTP |
SOAP |
SOAP web services | HTTP/HTTPS with SOAP |
GENERIC |
Custom protocols | Any |
Service Framework Components
Business Manager Configuration
Services are configured in Administration > Operations > Services:
- Service Configuration - General settings (enabled, logging, callbacks)
- Service Profile - Rate limiting and circuit breaker settings
- Service Credential - URL and authentication credentials
Script Components
| Component | Purpose |
|---|---|
LocalServiceRegistry |
Creates service instances |
ServiceCallback |
Defines request/response handling |
Service |
Base service with common methods |
Result |
Response object with status and data |
Basic Pattern
'use strict';
var LocalServiceRegistry = require('dw/svc/LocalServiceRegistry');
var myService = LocalServiceRegistry.createService('my.service.id', {
/**
* Configure the request before it is sent
* @param {dw.svc.HTTPService} svc - The service instance
* @param {Object} params - Parameters passed to service.call()
* @returns {string} Request body
*/
createRequest: function (svc, params) {
svc.setRequestMethod('POST');
svc.addHeader('Content-Type', 'application/json');
return JSON.stringify(params);
},
/**
* Parse the response after a successful call
* @param {dw.svc.HTTPService} svc - The service instance
* @param {dw.net.HTTPClient} client - The HTTP client with response
* @returns {Object} Parsed response
*/
parseResponse: function (svc, client) {
return JSON.parse(client.text);
},
/**
* Filter sensitive data from logs (required for production)
* @param {string} msg - The message to filter
* @returns {string} Filtered message
*/
filterLogMessage: function (msg) {
return msg.replace(/("api_key"\s*:\s*")[^"]+"/g, '$1***"');
}
});
// Call the service
var result = myService.call({ key: 'value' });
if (result.ok) {
var data = result.object;
} else {
var error = result.errorMessage;
}
Service Callbacks
| Callback | Required | Description |
|---|---|---|
createRequest |
Yes* | Configure request, return body |
parseResponse |
Yes* | Parse response, return result object |
execute |
No | Custom execution logic (replaces default) |
initServiceClient |
No | Create/configure underlying client |
mockCall |
No | Return mock response (execute phase only) |
mockFull |
No | Return mock response (entire call) |
filterLogMessage |
Recommended | Filter sensitive data from logs |
getRequestLogMessage |
No | Custom request log message |
getResponseLogMessage |
No | Custom response log message |
*Required unless execute is implemented
Result Object
The call() method returns a dw.svc.Result:
| Property | Type | Description |
|---|---|---|
ok |
Boolean | True if successful |
status |
String | "OK", "ERROR", or "SERVICE_UNAVAILABLE" |
object |
Object | Response from parseResponse |
error |
Number | Error code (e.g., HTTP status) |
errorMessage |
String | Error description |
unavailableReason |
String | Why service is unavailable |
mockResult |
Boolean | True if from mock callback |
Unavailable Reasons
| Reason | Description |
|---|---|
TIMEOUT |
Call timed out |
RATE_LIMITED |
Rate limit exceeded |
CIRCUIT_BROKEN |
Circuit breaker open |
DISABLED |
Service disabled |
CONFIG_PROBLEM |
Configuration error |
Error Handling
var result = myService.call(params);
if (result.ok) {
return result.object;
}
// Handle different error types
switch (result.status) {
case 'SERVICE_UNAVAILABLE':
switch (result.unavailableReason) {
case 'RATE_LIMITED':
// Retry later
break;
case 'CIRCUIT_BROKEN':
// Service is down, use fallback
break;
case 'TIM
Установить b2c-webservices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл b2c-webservices?
Implement web service integrations in B2C Commerce using LocalServiceRegistry. Use this skill whenever the user needs to call external REST or SOAP APIs from a cartridge, configure service credentials and profiles in services.xml, handle HTTP requests with createRequest/parseResponse callbacks, set up FTP or SFTP file transfers, or troubleshoot circuit breaker errors. Also use when connecting to payment gateways, shipping providers, or third-party services -- even if they just say 'call an external API from my controller' or 'my service keeps timing out'.
Как установить скилл b2c-webservices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл b2c-webservices запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic