Cert++
Close

Handling the dw.svc.Result of a service call

Key Takeaway

Check status before you read the rest of a dw.svc.Result. object holds data only when the status is OK, and unavailableReason is non-null only when the status is SERVICE_UNAVAILABLE.

When B2C Commerce code calls a web service through the service framework, service.call() returns a dw.svc.Result object instead of the raw response. The Result tells you whether the call worked. On success it holds the parsed data. On failure it holds status codes and messages, so your script or controller can decide what to render or how to recover.

What happens during a call

When you call service.call() on a service instance, the framework first checks the rate limiter and the circuit breaker. If neither one blocks the call, your callbacks run. The framework then packages the outcome into the Result.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers.