Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad request while trying transfer-01-negotiation sample #241

Closed
subhi-huawei opened this issue Apr 22, 2024 · 12 comments
Closed

400 Bad request while trying transfer-01-negotiation sample #241

subhi-huawei opened this issue Apr 22, 2024 · 12 comments
Labels

Comments

@subhi-huawei
Copy link

subhi-huawei commented Apr 22, 2024

Bug Report

Describe the Bug

400 Bad request while trying transfer-01-negotiation sample

Expected Behavior

Response should be 200

Observed Behavior

Response is 400

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run the provider:
java -Dedc.keystore=transfer/transfer-00-prerequisites/resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.vault=transfer/transfer-00-prerequisites/resources/configuration/provider-vault.properties -Dedc.fs.config=transfer/transfer-00-prerequisites/resources/configuration/provider-configuration.properties -jar transfer/transfer-00-prerequisites/connector/build/libs/connector.jar
  1. Run the consumer:
java -Dedc.keystore=transfer/transfer-00-prerequisites/resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.vault=transfer/transfer-00-prerequisites/resources/configuration/consumer-vault.properties -Dedc.fs.config=transfer/transfer-00-prerequisites/resources/configuration/consumer-configuration.properties -jar transfer/transfer-00-prerequisites/connector/build/libs/connector.jar
  1. Run this with Postman:
curl --location 'http://localhost:19193/management/v2/policydefinitions' \
--header 'content-type: application/json' \
--data-raw '{
    "@context": {
        "@vocab": "https://w3id.org/edc/v0.0.1/ns/",
        "odrl": "https://www.w3.org/ns/odrl/2/"
    },
    "@id": "aPolicy",
    "policy": {
        "@context": "https://www.w3.org/ns/odrl.jsonld",
        "@type": "Set",
        "permission": [],
        "prohibition": [],
        "obligation": []
    }
}'

Detailed Description

image

Possible Implementation

Take the @context from the URL and paste it in the request body will solve the problem

Copy link

Thanks for your contribution 🔥 We will take a look asap 🚀

@ndr-brt
Copy link
Member

ndr-brt commented Apr 26, 2024

I guess you are on a Windows machine right? In that case switching to WSL should solve your issue because the window command line is not 100% supported.

@subhi-huawei
Copy link
Author

I am facing the error when I call the service from postman, not while executing a command line

@ndr-brt
Copy link
Member

ndr-brt commented Apr 29, 2024

it's a server issue, not a client one, my question was about from where you are running the connector, not the client :)

@subhi-huawei
Copy link
Author

I run using the following command
java -Dedc.keystore=transfer/transfer-00-prerequisites/resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.vault=transfer/transfer-00-prerequisites/resources/configuration/provider-vault.properties -Dedc.fs.config=transfer/transfer-00-prerequisites/resources/configuration/provider-configuration.properties -jar transfer/transfer-00-prerequisites/connector/build/libs/connector.jar

from terminal inside IntelliJ

@ndr-brt
Copy link
Member

ndr-brt commented Apr 29, 2024

which os?

@subhi-huawei
Copy link
Author

Windows 10

@ndr-brt
Copy link
Member

ndr-brt commented Apr 29, 2024

I guess you are on a Windows machine right? In that case switching to WSL should solve your issue because the window command line is not 100% supported.

so I already wrote the solution some comments ago ;)

@subhi-huawei
Copy link
Author

I tried with WSL and I am getting the same error, btw the other postman requests are working fine.

@subhi-huawei
Copy link
Author

subhi-huawei commented Apr 29, 2024

This is the related error:

image

and this is the command that I use to run the connector:
image

@ndr-brt
Copy link
Member

ndr-brt commented Apr 30, 2024

please change the odrl context url to http://www.w3.org/ns/odrl.jsonld

@subhi-huawei
Copy link
Author

Now it is working Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants