diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/AssetCreatorCommandLineRunner.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/AssetCreatorCommandLineRunner.java index 3a87b80b..293462b8 100755 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/AssetCreatorCommandLineRunner.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/AssetCreatorCommandLineRunner.java @@ -36,12 +36,12 @@ public class AssetCreatorCommandLineRunner implements CommandLineRunner { @Override public void run(String... args) throws Exception { - if (!edcAdapterService.doInitialAssetRegistration()) { + if (!edcAdapterService.registerAssetsInitially()) { // retry int retryDelaySeconds = 3; log.warn("retrying initial asset registration in " + retryDelaySeconds + " seconds"); Thread.sleep(retryDelaySeconds * 1000); - log.warn("retry successful: " + edcAdapterService.doInitialAssetRegistration()); + log.warn("retry successful: " + edcAdapterService.registerAssetsInitially()); } } } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EdcController.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EdcController.java index a96c13d8..c9db0d38 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EdcController.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/controller/EdcController.java @@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.*; import java.io.IOException; -import java.net.URL; import java.util.List; /** @@ -49,9 +48,9 @@ public class EdcController { */ @GetMapping("/catalog") @CrossOrigin - public ResponseEntity getEDCCatalog(@RequestParam String dspUrl) { + public ResponseEntity getCatalog(@RequestParam String dspUrl) { try { - var catalog = edcAdapter.getDSPCatalog(dspUrl); + var catalog = edcAdapter.getCatalog(dspUrl); return ResponseEntity.ok(catalog.toPrettyString()); } catch (IOException e) { log.warn(e.getMessage()); @@ -69,7 +68,7 @@ public ResponseEntity getEDCCatalog(@RequestParam String dspUrl) { @CrossOrigin public ResponseEntity getAssets(@RequestParam String assetId) { try { - var result = edcAdapter.sendDspGetRequest(List.of("v3", "assets", assetId)); + var result = edcAdapter.sendGetRequest(List.of("v3", "assets", assetId)); var stringData = result.body().string(); result.body().close(); return ResponseEntity.ok(stringData); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java index e9455d4c..da601c3d 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/EdcAdapterService.java @@ -27,7 +27,7 @@ import org.eclipse.tractusx.puris.backend.common.api.logic.service.VariablesService; import org.eclipse.tractusx.puris.backend.common.edc.logic.dto.EDR_Dto; import org.eclipse.tractusx.puris.backend.common.edc.logic.dto.datatype.DT_ApiMethodEnum; -import org.eclipse.tractusx.puris.backend.common.edc.logic.util.EDCRequestBodyBuilder; +import org.eclipse.tractusx.puris.backend.common.edc.logic.util.EdcRequestBodyBuilder; import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -49,7 +49,7 @@ public class EdcAdapterService { private VariablesService variablesService; private ObjectMapper objectMapper; @Autowired - private EDCRequestBodyBuilder edcRequestBodyBuilder; + private EdcRequestBodyBuilder edcRequestBodyBuilder; @Autowired private EndpointDataReferenceService edrService; @@ -57,6 +57,51 @@ public EdcAdapterService(ObjectMapper objectMapper) { this.objectMapper = objectMapper; } + /** + * Util method for issuing a GET request to the management api of your control plane. + * Any caller of this method has the responsibility to close + * the returned Response object after using it. + * @param pathSegments The path segments + * @return The response + * @throws IOException If the connection to your control plane fails + */ + public Response sendGetRequest(List pathSegments) throws IOException { + HttpUrl.Builder urlBuilder = HttpUrl.parse(variablesService.getEdcManagementUrl()).newBuilder(); + for (var pathSegment : pathSegments) { + urlBuilder.addPathSegment(pathSegment); + } + var request = new Request.Builder() + .get() + .url(urlBuilder.build()) + .header("X-Api-Key", variablesService.getEdcApiKey()) + .build(); + return CLIENT.newCall(request).execute(); + } + + /** + * Util method for issuing a POST request to the management api of your control plane. + * Any caller of this method has the responsibility to close + * the returned Response object after using it. + * @param requestBody The request body + * @param pathSegments The path segments + * @return The response from your control plane + * @throws IOException If the connection to your control plane fails + */ + private Response sendPostRequest(JsonNode requestBody, List pathSegments) throws IOException { + HttpUrl.Builder urlBuilder = HttpUrl.parse(variablesService.getEdcManagementUrl()).newBuilder(); + for (var pathSegment : pathSegments) { + urlBuilder.addPathSegment(pathSegment); + } + RequestBody body = RequestBody.create(MediaType.parse("application/json"), requestBody.toString()); + + var request = new Request.Builder() + .post(body) + .url(urlBuilder.build()) + .header("X-Api-Key", variablesService.getEdcApiKey()) + .header("Content-Type", "application/json") + .build(); + return CLIENT.newCall(request).execute(); + } /** * Call this method at startup to register the necessary request and @@ -65,29 +110,29 @@ public EdcAdapterService(ObjectMapper objectMapper) { * * @return true if all registrations were successful, otherwise false */ - public boolean doInitialAssetRegistration() { + public boolean registerAssetsInitially() { boolean result; - log.info("Registration of product-stock request api successful " + (result = registerDSPApiAsset(DT_ApiMethodEnum.REQUEST))); + log.info("Registration of product-stock request api successful " + (result = registerApiAsset(DT_ApiMethodEnum.REQUEST))); if (!result) return false; - log.info("Registration of product-stock response api successful " + (result = registerDSPApiAsset(DT_ApiMethodEnum.RESPONSE))); + log.info("Registration of product-stock response api successful " + (result = registerApiAsset(DT_ApiMethodEnum.RESPONSE))); if (!result) return false; - log.info("Registration of policy successful " + (result = registerDSPSimplePolicy())); + log.info("Registration of policy successful " + (result = registerPublicPolicy())); if (!result) return false; - log.info("Registration of contract definition successful " + (result = registerDSPSimpleContractDefinition())); + log.info("Registration of contract definition successful " + (result = registerPublicContractDefinition())); return result; } /** - * Util method to register a simple contract definition without restrictions + * Util method to register a public contract definition without restrictions * regarding the asset selector. Will therefore be applicable to all assets - * that were registered previously. Must be called after registerDSPSimplePolicy() + * that were registered previously. Must be called after registerPublicPolicy() * * @return true if successful */ - private boolean registerDSPSimpleContractDefinition() { - var body = edcRequestBodyBuilder.buildDSPContractDefinitionWithPublicPolicy(); + private boolean registerPublicContractDefinition() { + var body = edcRequestBodyBuilder.buildContractDefinitionWithPublicPolicyBody(); try { - var response = sendDspPostRequest(body, List.of("v2", "contractdefinitions")); + var response = sendPostRequest(body, List.of("v2", "contractdefinitions")); boolean result = response.isSuccessful(); if (!result) { log.warn("Contract definition registration failed \n" + response.body().string()); @@ -106,10 +151,10 @@ private boolean registerDSPSimpleContractDefinition() { * * @return true if successful */ - private boolean registerDSPSimplePolicy() { - var body = edcRequestBodyBuilder.buildPublicDSPPolicy(); + private boolean registerPublicPolicy() { + var body = edcRequestBodyBuilder.buildPublicPolicyBody(); try { - var response = sendDspPostRequest(body, List.of("v2", "policydefinitions")); + var response = sendPostRequest(body, List.of("v2", "policydefinitions")); boolean result = response.isSuccessful(); if (!result) { log.warn("Policy registration failed \n" + response.body().string()); @@ -128,10 +173,10 @@ private boolean registerDSPSimplePolicy() { * @param apiMethod the api method to register. * @return true if successful. */ - private boolean registerDSPApiAsset(DT_ApiMethodEnum apiMethod) { - var body = edcRequestBodyBuilder.buildDSPCreateAssetBody(apiMethod); + private boolean registerApiAsset(DT_ApiMethodEnum apiMethod) { + var body = edcRequestBodyBuilder.buildCreateAssetBody(apiMethod); try { - var response = sendDspPostRequest(body, List.of("v3", "assets")); + var response = sendPostRequest(body, List.of("v3", "assets")); boolean result = response.isSuccessful(); if (!result) { log.warn("Asset registration failed \n" + response.body().string()); @@ -144,7 +189,6 @@ private boolean registerDSPApiAsset(DT_ApiMethodEnum apiMethod) { } } - /** * Retrieve an (unfiltered) catalog from the partner with the * given dspUrl @@ -153,8 +197,8 @@ private boolean registerDSPApiAsset(DT_ApiMethodEnum apiMethod) { * @return The full catalog * @throws IOException If the connection to the partners control plane fails */ - public JsonNode getDSPCatalog(String dspUrl) throws IOException { - var response = sendDspPostRequest(edcRequestBodyBuilder.buildBasicDSPCatalogRequestBody(dspUrl, null), List.of("v2", "catalog", "request")); + public JsonNode getCatalog(String dspUrl) throws IOException { + var response = sendPostRequest(edcRequestBodyBuilder.buildBasicCatalogRequestBody(dspUrl, null), List.of("v2", "catalog", "request")); String stringData = response.body().string(); response.body().close(); return objectMapper.readTree(stringData); @@ -171,9 +215,9 @@ public JsonNode getDSPCatalog(String dspUrl) throws IOException { * @return An array of Catalog items. * @throws IOException If the connection to the partners control plane fails */ - private JsonNode getDSPCatalogItems(String dspUrl, Map filter) throws IOException { - var response = sendDspPostRequest(edcRequestBodyBuilder. - buildBasicDSPCatalogRequestBody(dspUrl, filter), List.of("v2", "catalog", "request")); + private JsonNode getCatalogItems(String dspUrl, Map filter) throws IOException { + var response = sendPostRequest(edcRequestBodyBuilder. + buildBasicCatalogRequestBody(dspUrl, filter), List.of("v2", "catalog", "request")); String stringData = response.body().string(); if (!response.isSuccessful()) { throw new IOException("Http Catalog Request unsuccessful"); @@ -214,59 +258,14 @@ private JsonNode getDSPCatalogItems(String dspUrl, Map filter) t * @return The JSON response to your contract offer. * @throws IOException If the connection to the partners control plane fails */ - private JsonNode startDspNegotiation(Partner partner, JsonNode catalogItem) throws IOException { - var requestBody = edcRequestBodyBuilder.buildDSPAssetNegotiation(partner, catalogItem); - var response = sendDspPostRequest(requestBody, List.of("v2", "contractnegotiations")); + private JsonNode initiateNegotiation(Partner partner, JsonNode catalogItem) throws IOException { + var requestBody = edcRequestBodyBuilder.buildAssetNegotiationBody(partner, catalogItem); + var response = sendPostRequest(requestBody, List.of("v2", "contractnegotiations")); String responseString = response.body().string(); response.body().close(); return objectMapper.readTree(responseString); } - - /** - * Util method for issuing a GET request to the management api of your control plane. - * - * @param pathSegments The path segments - * @return The response - * @throws IOException If the connection to your control plane fails - */ - public Response sendDspGetRequest(List pathSegments) throws IOException { - HttpUrl.Builder urlBuilder = HttpUrl.parse(variablesService.getEdcManagementUrl()).newBuilder(); - for (var pathSegment : pathSegments) { - urlBuilder.addPathSegment(pathSegment); - } - var request = new Request.Builder() - .get() - .url(urlBuilder.build()) - .header("X-Api-Key", variablesService.getEdcApiKey()) - .build(); - return CLIENT.newCall(request).execute(); - } - - /** - * Util method for issuing a POST request to the management api of your control plane. - * - * @param requestBody The request body - * @param pathSegments The path segments - * @return The response from your control plane - * @throws IOException If the connection to your control plane fails - */ - private Response sendDspPostRequest(JsonNode requestBody, List pathSegments) throws IOException { - HttpUrl.Builder urlBuilder = HttpUrl.parse(variablesService.getEdcManagementUrl()).newBuilder(); - for (var pathSegment : pathSegments) { - urlBuilder.addPathSegment(pathSegment); - } - RequestBody body = RequestBody.create(MediaType.parse("application/json"), requestBody.toString()); - - var request = new Request.Builder() - .post(body) - .url(urlBuilder.build()) - .header("X-Api-Key", variablesService.getEdcApiKey()) - .header("Content-Type", "application/json") - .build(); - return CLIENT.newCall(request).execute(); - } - /** * Sends a request to the own control plane in order to receive * the current status of the previously initiated contractNegotiations as @@ -276,8 +275,8 @@ private Response sendDspPostRequest(JsonNode requestBody, List pathSegme * @return The response body as String * @throws IOException If the connection to your control plane fails */ - public JsonNode getDspNegotiationState(String negotiationId) throws IOException { - var response = sendDspGetRequest(List.of("v2", "contractnegotiations", negotiationId)); + public JsonNode getNegotiationState(String negotiationId) throws IOException { + var response = sendGetRequest(List.of("v2", "contractnegotiations", negotiationId)); String stringData = response.body().string(); response.body().close(); return objectMapper.readTree(stringData); @@ -293,9 +292,9 @@ public JsonNode getDspNegotiationState(String negotiationId) throws IOException * @return The response object * @throws IOException If the connection to your control plane fails */ - public JsonNode startDspPullTransfer(Partner partner, String contractId, String assetId) throws IOException { - var body = edcRequestBodyBuilder.buildDSPDataPullRequestBody(partner, contractId, assetId); - var response = sendDspPostRequest(body, List.of("v2", "transferprocesses")); + public JsonNode initiateProxyPullTransfer(Partner partner, String contractId, String assetId) throws IOException { + var body = edcRequestBodyBuilder.buildProxyPullRequestBody(partner, contractId, assetId); + var response = sendPostRequest(body, List.of("v2", "transferprocesses")); String data = response.body().string(); response.body().close(); return objectMapper.readTree(data); @@ -310,8 +309,8 @@ public JsonNode startDspPullTransfer(Partner partner, String contractId, String * @return The response from your Controlplane * @throws IOException If the connection to your control plane fails */ - public JsonNode getDspTransferState(String transferId) throws IOException { - var response = sendDspGetRequest(List.of("v2", "transferprocesses", transferId)); + public JsonNode getTransferState(String transferId) throws IOException { + var response = sendGetRequest(List.of("v2", "transferprocesses", transferId)); String data = response.body().string(); response.body().close(); return objectMapper.readTree(data); @@ -320,7 +319,7 @@ public JsonNode getDspTransferState(String transferId) throws IOException { /** * Util method for sending a post request the given endpoint - * in order to initiate a consumer pull request. + * in order to initiate a proxy pull request. * Any caller of this method has the responsibility to close * the returned Response object after using it. * @@ -330,7 +329,7 @@ public JsonNode getDspTransferState(String transferId) throws IOException { * @param requestBodyString The request body in JSON format as String * @return The response from the endpoint defined in the url (which is usually the other party's data plane), carrying the asset payload */ - public Response sendDataPullRequest(String url, String authKey, String authCode, String requestBodyString) { + public Response postProxyPullRequest(String url, String authKey, String authCode, String requestBodyString) { try { RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), requestBodyString); Request request = new Request.Builder() @@ -340,7 +339,7 @@ public Response sendDataPullRequest(String url, String authKey, String authCode, .build(); return CLIENT.newCall(request).execute(); } catch (Exception e) { - log.error("Failed to send Data Pull request to " + url, e); + log.error("Failed to send Proxy Pull request to " + url, e); throw new RuntimeException(e); } } @@ -360,7 +359,7 @@ public String[] getContractForRequestApi(Partner partner) { filter.put("asset:prop:apibusinessobject", "product-stock"); filter.put("asset:prop:apipurpose", "request"); filter.put("asset:prop:version", variablesService.getPurisApiVersion()); - return getContractForRequestOrResponseApiApi(partner, filter); + return getContractForRequestOrResponseApi(partner, filter); } /** @@ -378,7 +377,7 @@ public String[] getContractForResponseApi(Partner partner) { filter.put("asset:prop:apibusinessobject", "product-stock"); filter.put("asset:prop:apipurpose", "response"); filter.put("asset:prop:version", variablesService.getPurisApiVersion()); - return getContractForRequestOrResponseApiApi(partner, filter); + return getContractForRequestOrResponseApi(partner, filter); } /** @@ -392,35 +391,35 @@ public String[] getContractForResponseApi(Partner partner) { * @param filter The filter to be applied on the level of the asset's properties object. * @return A String array or null, if negotiation or transfer have failed or the authCode did not arrive */ - public String[] getContractForRequestOrResponseApiApi(Partner partner, Map filter) { + private String[] getContractForRequestOrResponseApi(Partner partner, Map filter) { try { - JsonNode catalogItem = getDSPCatalogItems(partner.getEdcUrl(), filter).get(0); - JsonNode negotiationResponse = startDspNegotiation(partner, catalogItem); + JsonNode catalogItem = getCatalogItems(partner.getEdcUrl(), filter).get(0); + JsonNode negotiationResponse = initiateNegotiation(partner, catalogItem); String assetApi = catalogItem.get("@id").asText(); String negotiationId = negotiationResponse.get("@id").asText(); // Await confirmation of contract and contractId String contractId = null; for (int i = 0; i < 100; i++) { Thread.sleep(100); - var responseObject = getDspNegotiationState(negotiationId); + var responseObject = getNegotiationState(negotiationId); if ("FINALIZED".equals(responseObject.get("edc:state").asText())) { contractId = responseObject.get("edc:contractAgreementId").asText(); break; } } if (contractId == null) { - var negotiationState = getDspNegotiationState(negotiationId); + var negotiationState = getNegotiationState(negotiationId); log.warn("no contract id, last negotiation state: \n" + negotiationState.toPrettyString()); log.error("Failed to obtain " + assetApi + " from " + partner.getEdcUrl()); return null; } // Initiate transfer of edr - var transferResp = startDspPullTransfer(partner, contractId, assetApi); + var transferResp = initiateProxyPullTransfer(partner, contractId, assetApi); String transferId = transferResp.get("@id").asText(); for (int i = 0; i < 100; i++) { Thread.sleep(100); - transferResp = getDspTransferState(transferId); + transferResp = getTransferState(transferId); if ("STARTED".equals(transferResp.get("edc:state").asText())) { break; } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/ExternalConnectorService.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/ExternalConnectorService.java index eaa217d8..b4e2d9e5 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/ExternalConnectorService.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/service/ExternalConnectorService.java @@ -76,7 +76,7 @@ public List getAll() { */ private boolean checkUrl(String url) { try { - edcAdapter.getDSPCatalog(url); + edcAdapter.getCatalog(url); } catch (IOException e) { return false; } diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EdcRequestBodyBuilder.java similarity index 90% rename from backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java rename to backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EdcRequestBodyBuilder.java index 53557a74..fb0bae9c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EDCRequestBodyBuilder.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/common/edc/logic/util/EdcRequestBodyBuilder.java @@ -17,7 +17,7 @@ */ @Component @Slf4j -public class EDCRequestBodyBuilder { +public class EdcRequestBodyBuilder { @Autowired @@ -49,8 +49,8 @@ public class EDCRequestBodyBuilder { * @param filter Key-value-pairs, may be empty or null * @return The request body */ - public ObjectNode buildBasicDSPCatalogRequestBody(String counterPartyDspUrl, Map filter) { - var objectNode = getEDCContextObject(); + public ObjectNode buildBasicCatalogRequestBody(String counterPartyDspUrl, Map filter) { + var objectNode = getEdcContextObject(); objectNode.put("protocol", "dataspace-protocol-http"); objectNode.put("@type", "CatalogRequest"); objectNode.put("counterPartyAddress", counterPartyDspUrl); @@ -70,7 +70,7 @@ public ObjectNode buildBasicDSPCatalogRequestBody(String counterPartyDspUrl, Map * @param apiMethod The API method you want to register * @return The request body */ - public JsonNode buildDSPCreateAssetBody(DT_ApiMethodEnum apiMethod) { + public JsonNode buildCreateAssetBody(DT_ApiMethodEnum apiMethod) { var body = MAPPER.createObjectNode(); var context = MAPPER.createObjectNode(); context.put(VOCAB_KEY, EDC_NAMESPACE); @@ -114,7 +114,7 @@ public JsonNode buildDSPCreateAssetBody(DT_ApiMethodEnum apiMethod) { * * @return The request body */ - public JsonNode buildPublicDSPPolicy() { + public JsonNode buildPublicPolicyBody() { var body = MAPPER.createObjectNode(); var context = MAPPER.createObjectNode(); context.put("odrl", ODRL_NAMESPACE); @@ -132,13 +132,13 @@ public JsonNode buildPublicDSPPolicy() { } /** - * Creates the request body for registering a simple contract definition. - * Relies on the policy that is created via the buildPublicDSPPolicy() method. + * Creates the request body for registering a public contract definition. + * Relies on the policy that is created via the buildPublicPolicy() method. * * @return The request body */ - public JsonNode buildDSPContractDefinitionWithPublicPolicy() { - var body = getEDCContextObject(); + public JsonNode buildContractDefinitionWithPublicPolicyBody() { + var body = getEdcContextObject(); body.put("@id", publicContractDefinitionId); body.put("accessPolicyId", publicPolicyId); body.put("contractPolicyId", publicPolicyId); @@ -154,7 +154,7 @@ public JsonNode buildDSPContractDefinitionWithPublicPolicy() { * @param dcatCatalogItem The catalog entry that describes the target asset. * @return The request body */ - public ObjectNode buildDSPAssetNegotiation(Partner partner, JsonNode dcatCatalogItem) { + public ObjectNode buildAssetNegotiationBody(Partner partner, JsonNode dcatCatalogItem) { var objectNode = MAPPER.createObjectNode(); var contextNode = MAPPER.createObjectNode(); contextNode.put(VOCAB_KEY, EDC_NAMESPACE); @@ -178,7 +178,7 @@ public ObjectNode buildDSPAssetNegotiation(Partner partner, JsonNode dcatCatalog } /** - * Creates the request body for requesting a data pull transfer using the + * Creates the request body for requesting a proxy pull transfer using the * DSP protocol and the Tractus-X-EDC. * * @param partner The Partner who controls the target asset @@ -186,8 +186,8 @@ public ObjectNode buildDSPAssetNegotiation(Partner partner, JsonNode dcatCatalog * @param assetId The assetId * @return The request body */ - public JsonNode buildDSPDataPullRequestBody(Partner partner, String contractID, String assetId) { - var body = getEDCContextObject(); + public JsonNode buildProxyPullRequestBody(Partner partner, String contractID, String assetId) { + var body = getEdcContextObject(); body.put("@type", "TransferRequestDto"); body.put("connectorId", partner.getBpnl()); body.put("connectorAddress", partner.getEdcUrl()); @@ -213,7 +213,7 @@ public JsonNode buildDSPDataPullRequestBody(Partner partner, String contractID, * * @return A request body stub */ - private ObjectNode getEDCContextObject() { + private ObjectNode getEdcContextObject() { ObjectNode node = MAPPER.createObjectNode(); var context = MAPPER.createObjectNode(); context.put(VOCAB_KEY, EDC_NAMESPACE); diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java index fb503558..7443a254 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockRequestApiServiceImpl.java @@ -230,7 +230,7 @@ public void handleRequest(ProductStockRequest productStockRequest) { try { String requestBody = objectMapper.writeValueAsString(response); - var httpResponse = edcAdapterService.sendDataPullRequest( + var httpResponse = edcAdapterService.postProxyPullRequest( endpoint, authKey, authCode, requestBody); log.info(httpResponse.body().string()); httpResponse.body().close(); @@ -298,7 +298,7 @@ public void doRequest(Material material, Partner supplierPartner){ Response response = null; try { String requestBody = objectMapper.writeValueAsString(productStockRequest); - response = edcAdapterService.sendDataPullRequest(endpoint, authKey, authCode, requestBody); + response = edcAdapterService.postProxyPullRequest(endpoint, authKey, authCode, requestBody); log.debug(response.body().string()); if(response.code() < 400) { productStockRequest = productStockRequestService.updateState(productStockRequest, DT_RequestStateEnum.Requested);