Skip to content

SOAPService

Dmytro Katashev edited this page Aug 12, 2024 · 1 revision

SOAPService API Reference

Overview

The SOAPService class extends the BaseService class, providing specialized functionality for interacting with SOAP-based web services in Salesforce Commerce Cloud (SFCC). It handles the creation of SOAP requests, execution of operations, and parsing of SOAP responses.

Inherits from: BaseService


Public Methods

fetch(params: SOAPParams)

Description: Executes a SOAP service call based on the provided parameters. It utilizes the createRequest, execute, and parseResponse methods to manage the request and handle the response.

  • Parameters:
    • params (SOAPParams): The parameters for creating and executing the SOAP service request.
  • Returns:
    • dw.svc.Result: The result of the service call, either success or error.

createRequest(svc: dw.svc.SOAPService, params: SOAPParams)

Description: Creates a SOAP request based on the provided parameters.

  • Parameters:
    • svc (dw.svc.SOAPService): The SOAP service instance.
    • params (SOAPParams): The parameters for creating the SOAP request.
  • Returns:
    • Object: The SOAP request payload.

execute(svc: dw.svc.SOAPService, requestPayload: Object)

Description: Executes the SOAP service request.

  • Parameters:
    • svc (dw.svc.SOAPService): The SOAP service instance.
    • requestPayload (Object): The request object to be sent in the SOAP operation.
  • Returns:
    • Object: The response object received from the SOAP service.

parseResponse(svc: dw.svc.SOAPService, responsePayload: Object)

Description: Parses the SOAP service response.

  • Parameters:
    • svc (dw.svc.SOAPService): The SOAP service instance.
    • responsePayload (Object): The response object received from the SOAP service.
  • Returns:
    • Object: The parsed response object.

Protected/Internal Methods

_initializeService(svc: dw.svc.SOAPService, args: SOAPParams)

Description: Initializes the SOAP service with basic configurations, such as setting the service client and operation.

  • Parameters:
    • svc (dw.svc.SOAPService): The SOAP service instance.
    • args (SOAPParams): The SOAP parameters.

_configureService(svc: dw.svc.SOAPService, args: SOAPParams)

Description: Configures the SOAP service by setting SOAP headers, HTTP headers, security configurations, and properties.

  • Parameters:
    • svc (dw.svc.SOAPService): The SOAP service instance.
    • args (SOAPParams): The SOAP parameters.

Types and Callbacks

SOAPHeader

Represents a SOAP header used in the request.

  • Type: Object
    • header (string | XML): The content of the SOAP header.
    • mustUnderstand (boolean): Indicates if the header must be understood.
    • actor (string): The actor for the header.

SOAPParams

Represents parameters for the SOAP service.

  • Type: Object
    • webReference (string): The web reference for the SOAP service.
    • service (Object): Details of the service being called.
      • name (string): The service name.
      • port (string): The service port.
    • operation (string): The SOAP operation to execute.
    • createRequestPayload (function): Callback function to create the SOAP request payload.
    • executeRequest (function): Callback function to execute the SOAP request.
    • parseResponsePayload (function): Callback function to parse the SOAP response payload.
    • onCreateRequest (function): Callback for customizing the SOAP request.
    • soapHeaders (SOAPHeader[]): An array of SOAP headers.
    • httpHeaders (Object.<string,string>): An object containing HTTP headers.
    • securityConfig (SecurityConfig): The security configuration for the SOAP request.
    • properties (SOAPProperties): The SOAP properties.

SecurityConfig

Represents security configuration for SOAP requests.

  • Type: Object
    • requestConfigMap (dw.util.HashMap): The request security configuration map.
    • responseConfigMap (dw.util.HashMap): The response security configuration map.

SOAPProperties

Represents properties that can be set on the SOAP service.

  • Type: Object
    • encoding (string): The encoding for the SOAP request.
    • endpoint (string): The endpoint address for the SOAP service.
    • session (boolean): Indicates if session should be maintained.
    • username (boolean): The username for authentication.
    • password (boolean): The password for authentication.

Clone this wiki locally