Skip to content

XML representation not working #128

@jnyblom

Description

@jnyblom

Hi,

There appears to be an issue when XML is set as representation and expected as output. This should probably be a PR instead of an issue, but here is explanation of the issue.

Minimal example:

    const queryDef = {
      schema: "nms:recipient",
      operation: "select",
      select: { node: [{ expr: "@id" }, { expr: "@email" }] },
      lineCount: 50,
    };

const query = client.NLWS.xml.xtkQueryDef.create(queryDef) // or xml set globally, same result
const result = await query.executeQuery()

Above throws error:

Error: TypeError: xmlRoot.hasAttribute is not a function
    at Client._writeSoapCallParameters ([...]\@adobe\acc-js-sdk\src\client.js:1334:38)

Issue seems to be in @adobe\acc-js-sdk\src\client.js:1319 - function _writeSoapCallParameters:

var xmlValue = this._fromRepresentation(docName, paramValue, paramRepresentation || representation);

Issue is that at this point representation is SimpleJson. _fromRepresentation with 'xml' as representation always return paramValue without changes. If we instead convert to xml from SimpleJson the subsequent hasAttribute and rest of code works:

var xmlValue = this._convertToRepresentation(paramValue, "SimpleJson", paramRepresentation || representation);

Regards,
Jonas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions