此示例演示了“提供商推送”用例,您可以在传输数据平面文档中找到更多详细信息。
1.消费端准备接收接口 2.提供商推送数据 3.提供商查看推送状态 4.消费端查看推送数据
一、以下在consumer端操作
1. 启动 http 服务器
作为先决条件,您需要启动一个http接口用于接收数据文件。这里使用http-request-logger启动一个logger服务器,在端口 4000 上运行并记录所有传入请求的日志,数据将被发送到该服务器。
docker build -t http-request-logger util/http-request-logger
docker run -p 4000:4000 http-request-logger
二、以下在provider端操作
2. 开始传输
在 transfer/transfer-02-consumer-pull/resources/start-transfer.json
嵌入上一节获取的合约协议"contractAgreementId": "0b3150be-feaf-43bc-91e1-90f050de28bd", <---------替换{{contract-agreement-id}}
修改后执行以下命令,注意与官方文档的路径不一致
curl -X POST "http://localhost:29193/management/v3/transferprocesses" -H "Content-Type: application/json" -d @transfer/transfer-02-provider-push/resources/start-transfer.json -s jq
返回值
{"@type":"IdResponse","@id":"bd98272e-a833-469a-ba64-0b11bcdb4edb","createdAt":1744023133780,"@context":{"@vocab":"https://w3id.org/edc/v0.0.1/ns/","edc":"https://w3id.org/edc/v0.0.1/ns/","odrl":"http://www.w3.org/ns/odrl/2/"}}
3、查看传输状态
执行命令
curl http://localhost:29193/management/v3/transferprocesses/<transfer process id>
$ curl http://localhost:29193/management/v3/transferprocesses/bd98272e-a833-469a-ba64-0b11bcdb4edb
返回结果
{
"@id": "bd98272e-a833-469a-ba64-0b11bcdb4edb",
"@type": "TransferProcess",
"state": "COMPLETED",#也可能是#"state": "TERMINATED", 接收服务器4000端口失败会导致
"stateTimestamp": 1744023152474,
"type": "CONSUMER",
"callbackAddresses": [],
"correlationId": "c50f2b97-3761-43e8-8c48-43de89f088b3",
"assetId": "assetId",
"contractId": "7b7981e0-844d-4471-bbe2-3192aa2b3775",
"transferType": "HttpData-PUSH",
"dataDestination": {
"@type": "DataAddress",
"type": "HttpData",
"baseUrl": "http://localhost:4000/api/consumer/store"
},
"@context": {
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"odrl": "http://www.w3.org/ns/odrl/2/"
}
}
注意传输已完成状态
4. 检查数据
docker logs http-request-logger(具体使用实例id)
2025-04-08 08:59:47 =============
2025-04-08 09:36:08 Incoming request
2025-04-08 09:36:08 Method: POST
2025-04-08 09:36:08 Path: /api/consumer/store
2025-04-08 09:36:08 Body:
2025-04-08 09:36:08 [
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 1,
2025-04-08 09:36:08 "name": "Leanne Graham",
2025-04-08 09:36:08 "username": "Bret",
2025-04-08 09:36:08 "email": "Sincere@april.biz",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Kulas Light",
2025-04-08 09:36:08 "suite": "Apt. 556",
2025-04-08 09:36:08 "city": "Gwenborough",
2025-04-08 09:36:08 "zipcode": "92998-3874",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-37.3159",
2025-04-08 09:36:08 "lng": "81.1496"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "1-770-736-8031 x56442",
2025-04-08 09:36:08 "website": "hildegard.org",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Romaguera-Crona",
2025-04-08 09:36:08 "catchPhrase": "Multi-layered client-server neural-net",
2025-04-08 09:36:08 "bs": "harness real-time e-markets"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 2,
2025-04-08 09:36:08 "name": "Ervin Howell",
2025-04-08 09:36:08 "username": "Antonette",
2025-04-08 09:36:08 "email": "Shanna@melissa.tv",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Victor Plains",
2025-04-08 09:36:08 "suite": "Suite 879",
2025-04-08 09:36:08 "city": "Wisokyburgh",
2025-04-08 09:36:08 "zipcode": "90566-7771",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-43.9509",
2025-04-08 09:36:08 "lng": "-34.4618"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "010-692-6593 x09125",
2025-04-08 09:36:08 "website": "anastasia.net",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Deckow-Crist",
2025-04-08 09:36:08 "catchPhrase": "Proactive didactic contingency",
2025-04-08 09:36:08 "bs": "synergize scalable supply-chains"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 3,
2025-04-08 09:36:08 "name": "Clementine Bauch",
2025-04-08 09:36:08 "username": "Samantha",
2025-04-08 09:36:08 "email": "Nathan@yesenia.net",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Douglas Extension",
2025-04-08 09:36:08 "suite": "Suite 847",
2025-04-08 09:36:08 "city": "McKenziehaven",
2025-04-08 09:36:08 "zipcode": "59590-4157",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-68.6102",
2025-04-08 09:36:08 "lng": "-47.0653"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "1-463-123-4447",
2025-04-08 09:36:08 "website": "ramiro.info",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Romaguera-Jacobson",
2025-04-08 09:36:08 "catchPhrase": "Face to face bifurcated interface",
2025-04-08 09:36:08 "bs": "e-enable strategic applications"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 4,
2025-04-08 09:36:08 "name": "Patricia Lebsack",
2025-04-08 09:36:08 "username": "Karianne",
2025-04-08 09:36:08 "email": "Julianne.OConner@kory.org",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Hoeger Mall",
2025-04-08 09:36:08 "suite": "Apt. 692",
2025-04-08 09:36:08 "city": "South Elvis",
2025-04-08 09:36:08 "zipcode": "53919-4257",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "29.4572",
2025-04-08 09:36:08 "lng": "-164.2990"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "493-170-9623 x156",
2025-04-08 09:36:08 "website": "kale.biz",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Robel-Corkery",
2025-04-08 09:36:08 "catchPhrase": "Multi-tiered zero tolerance productivity",
2025-04-08 09:36:08 "bs": "transition cutting-edge web services"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 5,
2025-04-08 09:36:08 "name": "Chelsey Dietrich",
2025-04-08 09:36:08 "username": "Kamren",
2025-04-08 09:36:08 "email": "Lucio_Hettinger@annie.ca",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Skiles Walks",
2025-04-08 09:36:08 "suite": "Suite 351",
2025-04-08 09:36:08 "city": "Roscoeview",
2025-04-08 09:36:08 "zipcode": "33263",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-31.8129",
2025-04-08 09:36:08 "lng": "62.5342"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "(254)954-1289",
2025-04-08 09:36:08 "website": "demarco.info",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Keebler LLC",
2025-04-08 09:36:08 "catchPhrase": "User-centric fault-tolerant solution",
2025-04-08 09:36:08 "bs": "revolutionize end-to-end systems"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 6,
2025-04-08 09:36:08 "name": "Mrs. Dennis Schulist",
2025-04-08 09:36:08 "username": "Leopoldo_Corkery",
2025-04-08 09:36:08 "email": "Karley_Dach@jasper.info",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Norberto Crossing",
2025-04-08 09:36:08 "suite": "Apt. 950",
2025-04-08 09:36:08 "city": "South Christy",
2025-04-08 09:36:08 "zipcode": "23505-1337",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-71.4197",
2025-04-08 09:36:08 "lng": "71.7478"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "1-477-935-8478 x6430",
2025-04-08 09:36:08 "website": "ola.org",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Considine-Lockman",
2025-04-08 09:36:08 "catchPhrase": "Synchronised bottom-line interface",
2025-04-08 09:36:08 "bs": "e-enable innovative applications"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 7,
2025-04-08 09:36:08 "name": "Kurtis Weissnat",
2025-04-08 09:36:08 "username": "Elwyn.Skiles",
2025-04-08 09:36:08 "email": "Telly.Hoeger@billy.biz",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Rex Trail",
2025-04-08 09:36:08 "suite": "Suite 280",
2025-04-08 09:36:08 "city": "Howemouth",
2025-04-08 09:36:08 "zipcode": "58804-1099",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "24.8918",
2025-04-08 09:36:08 "lng": "21.8984"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "210.067.6132",
2025-04-08 09:36:08 "website": "elvis.io",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Johns Group",
2025-04-08 09:36:08 "catchPhrase": "Configurable multimedia task-force",
2025-04-08 09:36:08 "bs": "generate enterprise e-tailers"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 8,
2025-04-08 09:36:08 "name": "Nicholas Runolfsdottir V",
2025-04-08 09:36:08 "username": "Maxime_Nienow",
2025-04-08 09:36:08 "email": "Sherwood@rosamond.me",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Ellsworth Summit",
2025-04-08 09:36:08 "suite": "Suite 729",
2025-04-08 09:36:08 "city": "Aliyaview",
2025-04-08 09:36:08 "zipcode": "45169",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-14.3990",
2025-04-08 09:36:08 "lng": "-120.7677"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "586.493.6943 x140",
2025-04-08 09:36:08 "website": "jacynthe.com",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Abernathy Group",
2025-04-08 09:36:08 "catchPhrase": "Implemented secondary concept",
2025-04-08 09:36:08 "bs": "e-enable extensible e-tailers"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 9,
2025-04-08 09:36:08 "name": "Glenna Reichert",
2025-04-08 09:36:08 "username": "Delphine",
2025-04-08 09:36:08 "email": "Chaim_McDermott@dana.io",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Dayna Park",
2025-04-08 09:36:08 "suite": "Suite 449",
2025-04-08 09:36:08 "city": "Bartholomebury",
2025-04-08 09:36:08 "zipcode": "76495-3109",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "24.6463",
2025-04-08 09:36:08 "lng": "-168.8889"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "(775)976-6794 x41206",
2025-04-08 09:36:08 "website": "conrad.com",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Yost and Sons",
2025-04-08 09:36:08 "catchPhrase": "Switchable contextually-based project",
2025-04-08 09:36:08 "bs": "aggregate real-time technologies"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 {
2025-04-08 09:36:08 "id": 10,
2025-04-08 09:36:08 "name": "Clementina DuBuque",
2025-04-08 09:36:08 "username": "Moriah.Stanton",
2025-04-08 09:36:08 "email": "Rey.Padberg@karina.biz",
2025-04-08 09:36:08 "address": {
2025-04-08 09:36:08 "street": "Kattie Turnpike",
2025-04-08 09:36:08 "suite": "Suite 198",
2025-04-08 09:36:08 "city": "Lebsackbury",
2025-04-08 09:36:08 "zipcode": "31428-2261",
2025-04-08 09:36:08 "geo": {
2025-04-08 09:36:08 "lat": "-38.2386",
2025-04-08 09:36:08 "lng": "57.2232"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 },
2025-04-08 09:36:08 "phone": "024-648-3804",
2025-04-08 09:36:08 "website": "ambrose.net",
2025-04-08 09:36:08 "company": {
2025-04-08 09:36:08 "name": "Hoeger LLC",
2025-04-08 09:36:08 "catchPhrase": "Centralized empowering task-force",
2025-04-08 09:36:08 "bs": "target end-to-end models"
2025-04-08 09:36:08 }
2025-04-08 09:36:08 }
2025-04-08 09:36:08 ]
2025-04-08 09:36:08 =============