Web Services

● Là language-agnostic được cung cấp từ xa (hay còn gọi là API)
● Cho phép tích hợp giữa các hệ thống không đồng nhất
OutSystems đã đơn giản hóa consuming and exposing bằng 2 tiêu chuẩn:

  • SOAP web services
  • REST APIs

SOAP

Định nghĩa

  • Contract chính thức hóa trong một tập tin Web Services Description Language (WSDL)
    • Tất cả các operations' parameters and return types được mô tả đầy đủ
    • SOAP services có thể cung cấp rất chi tiết contracts
  • Requests and responses bằng XML
  • Tập dự liệu trả về LỚN

Consuming SOAP

Consume một hoặc nhiều methods sử dụng SOAP 1.1SOAP 1.2 bindings:

  • Upload WSDL file hoặc URL
  • Chọn bindings
  • Chọn methods để consume

Using SOAP

OutSystems generates SOAP methods như một Server Actions. Generates bất kỳ data type compound nào như một Structures
Các generated elements này có thể được sử dụng bình thường như một Actions hoặc Structures
CÓ THỂ THAY ĐỔI:

  • Default values của Input Parameters
  • Namedescription của elements
  • Refresh option để có được service updates và change consumed methods
## Exposing SOAP

Để expose một Service trong OutSystems:

  • Create the Service
  • Create each method
  • Implement chúng như các Action

SOAP Endpoints

Endpoint thông tin của exposed Web Services trong Service Center
EndpointWSDL URLs sử dụng: host namemodule name

Endpoint: http://<hostname>/<ModuleName>/<WebServiceName>.asmx
SOAP WSDL: http://<hostname>/<ModuleName>/<WebServiceName>.asmx?WSDL

Web Service sẽ exposed với WSDLSOAP 1.1 hoặc SOAP 1.2 binding


REST

  • Là giải pháp thay thế cho SOAP với Tập dữ liệu trả về NHỎ
  • Không có API contract file chính thức
  • Cung cấp documentationexamples thay vì contract
  • Requests and responses (usually) bằng JSON gọn nhẹ

Consuming a REST method

Consume một single REST method

  • Cung cấp method's URL
  • Test để lấy giá trị response test
  • Có thể Copy response trong Body

Using REST methods

OutSystems generates REST như các Actions. Generates bất kỳ data type compound nào như một Structures
Các generated elements này có thể được sử dụng bình thường như một Actions hoặc Structures
CÓ THỂ THAY ĐỔI:

  • Default values của Input Parameters
  • Namedescription của elements
  • Data types của attributesparameters, cũng như addremove chúng

REST Callbacks

REST services Cung cấp 2 Callbacks:

  • OnBeforeRequest:: Actions tự động called trước khi request
  • OnAfterResponse:: Actions tự động called sau khi nhận được response
    Hữu ích cho debugCustomize requests:
  • Phát hiện và xử lý HTTP Status (400 and over)
  • Alter the sent and return values transparently to the caller code

Consuming a REST API

Consume tất cả các REST methods:

  • Cung cấp API URL
  • REST API PHẢI compliant (tuân thủ) Swagger chỉ định

Exposing REST

Để expose một Service trong OutSystems:

  • Create the Service
  • Create each method
  • Implement chúng như các Action

Logging

Consumedexposed Web Services có thể định cấu hình trong Service Center

  • Effective endpoint URL
  • Security
  • Log verbosity

Cấu hình được thực hiện trên mỗi module: Integrations tab trong Service Center

---

HẾT.

12312321312

đáhjasdjahdasdas
@Copyright 2022 by HieuEM Github