MYSQL-SMP3.0: IntegrationGatewaywithMySQLDatasource (Part3)

Source: Internet
Author: User
SMP3.0: IntegrationGatewaywithMySQLDatasource (Part3) 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'Sap'(Exact name as namespace) underSettings> Security profiles> New

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

4. GoDestinationsTab, CreateNewDestination

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

5. MoveServicesTab, click on deployed serviceEmployee_MYSQLDB.

    • Click on'Add Destination', SelectMYSQLDBFrom the drop-down.

    • Save and close.

6. Once done, open the service document,

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

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

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

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

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, useHTTP GETVerb to execute the same.

    • Open Advanced REST client

REQUEST:

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

    • Use HTTPGETVerb to execute this operation.

    • Pass below header values

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

RESPONSE:

    • 200 OK status message

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

OData Operations-InsertEntity (CREATE)
    • The InsertEntity operation creates an entity.

REQUEST:

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

    • UseHTTP POSTVerb to execute the InsertEntity operation.

    • Pass below header values

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

1006SACHINSHARMACHANDIGARHINDIA

RESPONSE:

    • This operation creates an entity.

    • Successful execution of the operation returnsHTTP 201 status codeAlong withLocationOf the newly created entity will be returned.

To verify, you can check with smpserver: 8080/gateway/odata/sap/employee_MySQLDB; v = 1/employee (1006) OR directly in the MySQL database.

OData Operations-UpdatetEntity (UPDATE)
    • The UpdateEntity operation updates an entity.

REQUEST

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

    • Use HTTPPUTVerb to execute the this operation.

    • Pass below header values

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

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

1003CHIPROGSAN FRANSUSA

RESPONSE:

    • If the update is successful, the server responds204 status code.

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

OData Operations-DeleteEntity (DELETE)
  • The DeleteEntity operation deletes an entity.

REQUEST

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

    • Use HTTPDELETEVerb to execute this operation.

    • Pass below header values

Header Values
X-CSRF-TOKEN 1b4687085d8f59b1ca41582df17d535a
Content-Type Application/xml

RESPONSE:

    • If the delete is successful, the server responds204 status code.

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

NextPart 4

The above is the MYSQL-SMP3.0: Integration Gateway with MySQL Datasource (Part 3) (text) content, more relevant content please pay attention to PHP Chinese network (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.