作者:公安边防临高支队警务微博_821 | 来源:互联网 | 2018-04-19 02:27
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
Log on to SMP 3.0 Admin: https://smpserver:port/Admin
Create a new security profile with name as ' sap ' (exact name as namespace) under Settings>Security profiles>New
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 |
5. Move to Services tab, click on deployed service employee_MYSQLDB.
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,use HTTP GET verb to execute the same.
REQUEST:
Header | Values |
---|
X-CSRF-TOKEN | FETCH |
Content-Type | application/xml |
RESPONSE :
OData Operations – InsertEntity (CREATE)
REQUEST :
Header | Values |
---|
X-CSRF-TOKEN | 1B4687085D8F59B1CA21382DF17D535A |
Content-Type | application/xml |
1006SACHINSHARMACHANDIGARHINDIA
RESPONSE :
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)
REQUEST
Header | Values |
---|
X-CSRF-TOKEN | 1B4687085D8F59B1CA21382DF17D535A |
Content-Type | application/xml |
xml version="1.0" encoding="UTF-8"?>
1003CHIPROGSAN FRANSUSA
RESPONSE :
OData Operations – DeleteEntity (DELETE)
REQUEST
Header | Values |
---|
X-CSRF-TOKEN | 1B4687085D8F59B1CA21382DF17D535A |
Content-Type | application/xml |
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.
NextPart 4
以上就是MYSQL-SMP3.0 : Integration Gateway with MySQL Datasource (Part 3)(图文)的内容,更多相关内容请关注PHP中文网(www.php1.cn)!