Java Binding :: ExerciseCommand - multiSubmit mode
- liavOP
Following @Leonid_Rozenberg lead on submit API i was able to implement a scenario in which a multi party submit is performed on an existing contract.
However, i face an “UNAUTHENTICATED” error although i made sure my tokens are up-to-date. I belive the root cause is one of the following bullets (code is shown below):
-
The choice receives a party and productId - Is the party suppose to be the contract’s owner?
-
The Exercise receives actAs and readAs which are currently set to the new created party (“dummyParty”) and the owner. Is this correct input? Should i populate both list with same parties?
private void exerciseCommandOnProduct(String contractId, ProductFields productFields, String multiPartyToken) { List<String> actAs = Arrays.asList(damlProperties.getOwnerParty(), "dummyParty"); List<String> readAs = Arrays.asList(damlProperties.getOwnerParty(), "dummyParty"); ArrayList<DamlRecord.Field> fields = new ArrayList<DamlRecord.Field>(); fields.add(new DamlRecord.Field(new Party(damlProperties.getOwnerParty()))); fields.add(new DamlRecord.Field(new Party(productFields.getProductCode()))); DamlRecord choiceArgument = new DamlRecord(fields); ExerciseCommand command = new ExerciseCommand(TEMPLATE_ID, contractId, "CustomerCreatesPolicyRequest", choiceArgument); List<Command> commands = Collections.singletonList(command); final Single<Empty> emptySingle = client. getCommandSubmissionClient(). submit(WORKFLOW_ID, APPLICATION_ID, UUID.randomUUID().toString(), actAs, readAs, commands, multiPartyToken); emptySingle.blockingGet(); }Thanks
-
- cocreature
UNAUTHENTICATED is an issue with your token. Either it’s not set or it’s invalid in some form (e.g. expired). I recommend to look at the ledger logs to see the issue.
- liav
Thanks @cocreature, where are the logs located?
- cocreature
Somewhat depends on your ledger setup, usually you either get a log file or it’s written to stdout.
- liav
Is your answer refer to DamlHub or sandbox?
- cocreature
I was thinking of self-hosted ledgers. For hub, you cannot get access directly. I’ll reach out to the hub team for help.
- liav
Appriciate it. Thanks
- dtanabe
I believe you’re an enterprise user so if you want the logs pulled, can you open a support ticket with your ledger ID? We can pull the logs that way.
Additionally:
- your token must authorize you to perform actions as the parties that you are trying to actAs/readAs; simply including them in your command submission request won’t be enough.
- on Daml Hub, we currently only allow multiparty tokens that include a reference to a party and a readAs for the so-called “public” party (see this post How to fetch a contract from dumlhub Ledger via Java - #20 by Leonid_Rozenberg)