Нужна помощь в определении чванства (Настройка RESTful DSN в AEM, интеграция с ServiceNow - PullRequest
0 голосов
/ 08 марта 2020

Я настроил Restful DSN в AEM, предоставив swagger do c и создал модель данных и сервисы формы.

Пост успешно вставляет запись в таблицу ServiceNow, но get всегда возвращая нулевое значение. Не уверен, что причиной является ответ json от ServiceNow, заключенный в result. Я предоставляю чванство json, а также ответ от ServiceNow. Я импортировал свой swagger do c в SOAPUI, и я мог получить записи, но с помощью AEM разве он не идентифицирует мой тип возврата как Array для объекта ImpairmentResponse

Я очень благодарен, если кто-то может go над ними и предложить необходимые изменения в определениях чванства.

Swagger doc:



{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "Test Service",
"description": "API that uses a ServiceNow as an example to demonstrate features in the swagger-2.0 specification"
},
"host": "localdev.service-now.com",
"basePath": "/api/now/table",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"securityDefinitions": {
"basicAuth": {
"type": "basic"
}
},
"paths": {
"/u_impairment": {
"get": {
"operationId": "getImpairmentList",
"produces": [
"application/json"
],
"security": [
{
"basicAuth": []
}
],
"parameters": [
{
"name": "sysparm_limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer"
}
],
"responses": {
"200": {
"description": "Impairment response",
"schema": {

"$ref": "#/definitions/ImpairmentResponse"

}
}
}
},
"post": {
"description": "Report new Impairment. Duplicates are allowed",
"operationId": "Create",
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"description": "Report Impairment",
"required": true,
"schema": {
"$ref": "#/definitions/ReportImpairment"
}
}
],
"responses": {
"200": {
"description": "Impairment response",
"schema": {

"$ref": "#/definitions/ImpairmentResponse"

}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/ErrorModel"
}
}
}
}
}
},
"definitions": {
"ImpairmentResponse": {
"type": "object",
"properties": {
"result": {
"type":"array",
"items": {
"allOf": [
{
"$ref": "#/definitions/ReportImpairment"
},
{
"properties": {
"u_number": {
"type": "string"
},
"sys_id": {
"type": "string"
}
}
}
]
}
}
}
},
"ReportImpairment": {
"type": "object",
"properties": {
"u_email_address": {
"type": "string"
},
"u_facility_name": {
"type": "string"
},
"u_status": {
"type": "string"
},
"sys_created_on": {
"type": "string"
},
"sys_created_by": {
"type": "string"
}
}
},
"ErrorModel": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}







Response json from ServiceNow:

{"result": [
{
"u_email_address": "test123@gmail.com",
"u_facility_name": "test1",
"u_status": "new",
"sys_created_on": "2020-02-25 13:09:50",
"sys_created_by": "testing",
"sys_id": "0b7f4a351bcf0010b8fb2f89bd4bcbe7",
"u_number": "FIR0001007"

},
{
"u_email_address": "jonnytest@gmail.com",
"u_facility_name": "test123",
"u_status": "new",
"sys_created_on": "2020-03-01 13:09:50",
"sys_created_by": "testing",
"sys_id": "0e19c8fe1b5bc410b8fb2f89bd4bcb29",
"u_number": "FIR00010010"
}
]}
...