MYSQL-SMP3.0 : Integration Gateway with MySQL Datasource (Part 3)(图文)

PHP中文网
풀어 주다: 2017-03-30 16:02:29
원래의
985명이 탐색했습니다.

Here we will see how to create a destination in Gateway cockpit and map it manually to deployed OData service and then how to perform CRUD operation on service document.

Test the OData service

  1. Log on to SMP 3.0 Admin: https://smpserver:port/Admin

  2. Create a new security profile with name as ' sap ' (exact name as namespace) under Settings>Security profiles>New

27.png

3. Log on to SMP3 gateway cockpit https://smpserver:port/gateway/cockpit

4. Go to destinations tab, Create a new destination

Properties Values
Destination Type DATABASE
Destination URL jdbc:mysql://MySQLSeverip/schema_name
Destination Driver com.mysql.jdbc.Driver
Authentication Type Basic Authentication
User Name DB User
Password DB password

28.PNG  

5. Move to Services tab, click on deployed service employee_MYSQLDB.  

    • Click on 'Add Destination ', select MYSQLDB from the drop-down.

    • Save and close.

     1.png

6. Once done, open the service document,

1.png

http://smpserver:8080/gateway/odata/sap/employee_MySQLDB;v=1

1.png

7. Open service metadata document

    • OData defines a metadata format based on the Entity Data Model in XML (edmx).

    • To access a service's metadata document use the $metadata command.

    • The returned document is the service's edmx metadata + backend metadata

smpserver:8080/gateway/odata/sap/employee_MySQLDB;v=1/$metadata

1.png

8. To get the details for the Entity 'employee'

smpserver:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee

     1.png  

To fetch only first row of the table, 

smpserver:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee(1001)

OData operations : RetrieveEntity (READ)

To retrieve details of a specific entity,use HTTP GET verb to execute the same.

    • Open Advanced REST client

REQUEST:  

    • URL: jk:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee

    • Use HTTP GET verb to execute this operation.

    • Pass below header values

Header Values
X-CSRF-TOKEN FETCH
Content-Type application/xml

     1.png

RESPONSE :

    • 200 OK status message

    • X-CSRF-TOKEN value e.g. 1B4687085D8F59B1CA21382DF17D535A

          1.png  

OData Operations – InsertEntity (CREATE)

    • The InsertEntity operation creates an entity.

REQUEST :

    • URL: jk:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee

    • Use HTTP POST verb to execute the InsertEntity operation.

    • Pass below header values

Header Values
X-CSRF-TOKEN 1B4687085D8F59B1CA21382DF17D535A
Content-Type application/xml
    • Pass this xml text into the BODY

1006SACHINSHARMACHANDIGARHINDIA
로그인 후 복사

1.png

RESPONSE :

    • This operation creates an entity.

    • Successful execution of the operation returns HTTP 201 status code along with the Location of the newly created entity will be returned.

1.png

MYSQL-SMP3.0 : Integration Gateway with MySQL Datasource (Part 3)(图文) To verify, you can check with smpserver:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee(1006) OR directly in the MySQL database.

1.png

OData Operations – UpdatetEntity (UPDATE)

    • The UpdateEntity operation updates an entity.

REQUEST

    • URL: jk:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee(1003)

    • Use HTTP PUT verb to execute the this operation.

    • Pass below header values

Header Values
X-CSRF-TOKEN1B4687085D8F59B1CA21382DF17D535A
Content-Typeapplication/xml
    • Pass this xml text into the BODY

xml version="1.0" encoding="UTF-8"?>

1003CHIPROGSAN FRANSUSA
로그인 후 복사

1.png

RESPONSE :

    • If the update is successful, the server responds with 204 status code .

    • As the response code text " No Content " signifies, no data is returned in the Response Body.

1.png

1.png

OData Operations – DeleteEntity (DELETE)

  • The DeleteEntity operation deletes an entity.

REQUEST

    • URL: jk:8080/gateway/odata/sap/employee_MySQLDB;v=1/employee(1006)

    • Use HTTP DELETE verb to execute this operation.

    • Pass below header values

Header Values
X-CSRF-TOKEN 1B4687085D8F59B1CA21382DF17D535A
Content-Type application/xml

1.png

RESPONSE :

    • If the delete is successful, the server responds with 204 status code.

    • As the response code text " No Content " signifies, no data is returned in the Response Body.

1.png

1.png

NextPart 4

 以上就是MYSQL-SMP3.0 : Integration Gateway with MySQL Datasource (Part 3)(图文)的内容,更多相关内容请关注PHP中文网(www.php.cn)!

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!