File

projects/wms-framework/src/lib/wcfserviceinvocationsupport/Message.ts

Description

Defines a message to be sent to the server in order to get a response or execute an action. Concrete classes can customize how the message format

Index

Properties
Methods

Properties

Public BaseUrl
Type : string

The service base url. This message uses the base url to create the final url using message information such as end point suffic, post or get or method name

Public EndpointSuffix
Type : string
Default value : ''

Specifies and addition suffix to be appended to the base url

Headers
Type : SimpleList<MessageHeader>
Default value : new SimpleList<MessageHeader>()

List of Headers

methodName
Type : string
Default value : null

Name of the method to call

requestArgs
Type : any[]
Default value : []

Request arguments

responseType
Type : string
Default value : 'json'

The expected response type from the request.

result
Type : any

Service result

Public UsePost
Type : boolean
Default value : true

Indicates whether this message must be sent using a POST called instead of the default GET method.

Methods

Public Abstract buildBody
buildBody()

Creates the message body to be sent

Returns : any

{*}

Public Abstract buildPostResult
buildPostResult(userData: any, result: any)

Creates the {IAsyncResult} object for a POST operation.

Parameters :
Name Type Optional
userData any No
result any No
Returns : IAsyncResult

{IAsyncResult}

Public Abstract buildUrl
buildUrl()

Creates a url where to send this message

Returns : string

{string}

import { SimpleList } from '../baseframework/collections';
import { IAsyncResult } from './AsyncResultSupport';
import { MessageHeader } from './MessageHeader';

/**
 * Defines a message to be sent to the server in order to get a response or execute
 * an action.  Concrete classes can customize how the message format
 *
 * @export
 * @class Message
 */
export abstract class Message {
  /**
   * The service base url.  This message uses the base url to create the final url using
   * message information such as end point suffic, post or get or method name
   *
   * @type {string}
   * @memberof Message
   */
  public BaseUrl: string;

  /**
   * Specifies and addition suffix to be appended to the base url
   *
   * @type {string}
   * @memberof Message
   */
  public EndpointSuffix: string = '';

  /**
   * Indicates whether this message must be sent using a POST called instead of the default
   * GET method.
   *
   * @type {boolean}
   * @memberof Message
   */
  public UsePost: boolean = true;

  /**
   *  List of Headers
   *
   * @type {HttpClient}
   * @memberof Message
   */
  Headers: SimpleList<MessageHeader> = new SimpleList<MessageHeader>();

  /**
   *  Name of the method to call
   *
   * @type {string}
   * @memberof Message
   */
  methodName: string = null;

  /**
   *  Request arguments
   *
   * @type {any[]}
   * @memberof Message
   */
  requestArgs: any[] = [];

  /**
   * Service result
   *
   * @type {any[]}
   * @memberof Message
   */
  result: any;

  /**
   * The expected response type from the request.
   *
   * @type {string}
   * @memberof Message
   */
  responseType: string = 'json';

  /**
   * Creates a url where to send this message
   *
   * @abstract
   * @return {*}  {string}
   * @memberof Message
   */
  public abstract buildUrl(): string;

  /**
   * Creates the message body to be sent
   *
   * @abstract
   * @return {*}  {*}
   * @memberof Message
   */
  public abstract buildBody(): any;

  /**
   * Creates the {IAsyncResult} object for a POST operation.
   *
   * @abstract
   * @return {*}  {IAsyncResult}
   * @memberof Message
   */
  public abstract buildPostResult(userData: any, result: any): IAsyncResult;
}

result-matching ""

    No results matching ""