镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Agent cannot parse json asset #477

Open

Description

@robot-ranger

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?

Activity

  1. wsobel commented on Jul 15, 2024

    @wsobel
    Member

    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.

  2. self-assigned this
    on Jul 15, 2024
  3. added theissue type on Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions