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

Agent cannot parse json asset #477

Open
robot-ranger opened this issue Jul 10, 2024 · 1 comment
Open

Agent cannot parse json asset #477

robot-ranger opened this issue Jul 10, 2024 · 1 comment
Assignees
Labels

Comments

@robot-ranger
Copy link
Contributor

robot-ranger commented Jul 10, 2024

Unless Im doing it wrong, It looks like the agent is expecting xml for assets. I tried sending the following with a curl command:

{
	"TaskArchetype": {
		"assetId": "LoadCnc",
		"Priority": 2,
		"TaskType": "MATERIAL_LOAD",
		"Coordinator": {
			"collaboratorId": "cnc1",
			"CollaboratorType": "CNC"
		},
		"Collaborators": {
			"Collaborator": {
				"collaboratorId": "r1",
				"CollaboratorType": "ROBOT"
			}
		},
		"SubTaskRefs": [
			{
				"order": "1",
				"value": "OpenDoor"
			},
			{
				"order": "2",
				"value": "MoveIn"
			},
			{
				"order": "3",
				"value": "ReleasePart"
			},
			{
				"order": "4",
				"value": "CloseChuck"
			},
			{
				"order": "5",
				"value": "MoveOut"
			},
			{
				"order": "6",
				"value": "CloseDoor"
			}
		]
	}
}

curl -X POST "http://192.168.1.1:5000/asset/load-cnc-1?device=mxi_m001&type=TaskArchetype" -H "Content-Type: application/json" -d @load-cnc.json

but got:

<?xml version="1.0" encoding="UTF-8"?>
<MTConnectError xmlns:m="urn:mtconnect.org:MTConnectError:2.3"
	xmlns="urn:mtconnect.org:MTConnectError:2.3"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="urn:mtconnect.org:MTConnectError:2.3 /schemas/MTConnectError_2.3.xsd">
	<Header creationTime="2024-07-10T03:26:52Z" sender="0cfa26291d8b" instanceId="1720580135"
		version="2.3.0.16" deviceModelChangeTime="2024-07-10T02:55:35.142034Z" bufferSize="16384" />
	<Errors>
		<Error errorCode="INVALID_REQUEST">Could not parse Asset.</Error>
		<Error errorCode="INVALID_REQUEST">: Cannot parse asset</Error>
	</Errors>
</MTConnectError>

We had eliminated xml in favor of json response docs from the agent. Can we add json parser capability to cppagent's assets?

@wsobel
Copy link
Member

wsobel commented Jul 15, 2024

This will need to be added as a feature. We do not have a json entity parser at the moment. I can add one, but it will be a lot of work with a full test suite.

I can start working on it soon.

@wsobel wsobel added the feature label Jul 15, 2024
@wsobel wsobel self-assigned this Jul 15, 2024
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