IIB 10.0 – Using ESQL to create xmlsc document with namespace turns attributes into elements

I am using ESQL to create a XMLNSC document that has a namespace. When I do this, attributes are turned into elements causing the xml to be invalid. Below is the code to create the document in ESQL.

BEGIN
DECLARE pendingDownstreamService REFERENCE to Environment.Variables.PENDING_DOWNSTREAM_SERVICES[1];
DECLARE wd NAMESPACE ‘urn:com.workday/bsvc’;
DECLARE employeeIdAsText CHARACTER;
DECLARE employeeIdToStartDate ROW;
DECLARE employeeCount INTEGER 1;

CALL CopyMessageHeaders();
CALL CopyEntireMessage();

SET OutputRoot.XMLNSC.wd:Get_Workers_Request.(XMLNSC.NamespaceDecl)xmlns:”wd” = ‘urn:com.workday/bsvc’;
SET OutputRoot.XMLNSC.wd:Get_Workers_Request.(XMLNSC.Attribute)wd:version = ‘v26.2’;
SET OutputRoot.XMLNSC.wd:Get_Workers_Request.wd:Response_Group.wd:Include_Employment_Information = ‘true’;

WHILE lastmove(pendingDownstreamService) DO
IF (pendingDownstreamService.EMPLOYEE_ID IS NOT NULL) THEN
SET employeeIdAsText = CAST(pendingDownstreamService.EMPLOYEE_ID AS CHARACTER);
IF (employeeIdToStartDate.{employeeIdAsText} IS NULL) THEN
SET OutputRoot.XMLNSC.wd:Get_Workers_Request.wd:Request_References.wd:Worker_Reference[employeeCount].wd:ID.(XMLNSC.Attribute)wd:type=’Employee_ID’;
SET OutputRoot.XMLNSC.wd:Get_Workers_Request.wd:Request_References.wd:Worker_Reference[employeeCount].wd:ID VALUE = pendingDownstreamService.EMPLOYEE_ID;

SET employeeIdToStartDate.{employeeIdAsText} = pendingDownstreamService.START_DATE;
SET employeeCount = employeeCount + 1;
END IF;
END IF;

MOVE pendingDownstreamService NEXTSIBLING;
END WHILE;

RETURN TRUE;
END;
![alt text][1]

Attached is the message from the flow recorder. You can see that the Get_Workers_Request element has version as a child element while the esql code adds the version as an attribute. Additionally, the wd:Get_Workers_Request.wd:Request_References.wd:Worker_Reference.wd:ID element has type as a child element while the esql adds type as an atttribute. I also don’t see the namespace declaration attribute in the Get_Workers_Request element so I am not sure if that is a problem as well. I would expect to see something like

in the flow recorder.

How can I add attributes to an XMLNSC document when using namespaces?

[1]: /answers/storage/temp/16366-get-workers.png

Related:

Leave a Reply